如何在桌面应用程序的生命周期中随时创建可以使用的对象? [英] How do I create an object that I can use anytime during the life of my desktop app?

查看:72
本文介绍了如何在桌面应用程序的生命周期中随时创建可以使用的对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了Google和Code Project,但我找不到任何有用的东西。



我的C#SoftPhone桌面应用程序(使用.NET 3.5 Framework)需要在用户发起转接或电话会议时从语音交互中捕获两个数据点(I我已经这样做了)并将这两个数据点存储在一个对象中,以后可以通过应用程序在语音交互的生命周期内访问(电话)



我尝试了什么:



我尝试过创建一个Singleton但我不认为我做错了或者它不适用于我的C#SoftPhone桌面应用场景

I searched Google and Code Project but I could not find anything useful.

My C# SoftPhone desktop app (using the .NET 3.5 Framework) needs to capture two data points from the voice interaction when the user initiates a transfer or conference call (I am already doing this) and store these two data points in an object that can be accessed later on by the app during the life of the voice interaction (phone call)

What I have tried:

I have tried creating a Singleton but I don't think I did it correct or it does not apply to my C# SoftPhone desktop app scenario

推荐答案

您可以创建一个包含所需内容的静态类。我有一个我称之为Globals的东西。
You can create a static class that contains anything you want. I have one like that that I call "Globals".


这篇关于如何在桌面应用程序的生命周期中随时创建可以使用的对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆