本文整理汇总了C#中System.Windows.Forms.ApplicationContext类的典型用法代码示例。如果您正苦于以下问题:C# ApplicationContext类的具体用法?C# ApplicationContext怎么用?C# ApplicationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationContext类属于System.Windows.Forms命名空间,在下文中一共展示了ApplicationContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoginForm
public LoginForm(ApplicationContext context)
{
_context = context;
InitializeComponent();
btnLogin.Click += (sender, args) => Invoke(Login);
}
示例2: Main
static void Main()
{
ApplicationContext applicationContext = new ApplicationContext();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new HostFrom());
}
示例3: Main
static void Main()
{
var f2 = new Form2();
var c = new ApplicationContext(f2);
Application.Run(c);
return;
if (mutex.WaitOne(TimeSpan.Zero, true))
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var settings = Settings.Init();
var engine = new Switcher(settings);
Application.ApplicationExit += (s, a) => { engine.Dispose(); };
var app = new SettingsForm(settings, engine);
app.Exit += (s, e) => Application.Exit();
var context = new ApplicationContext(app);
Application.Run(context);
mutex.ReleaseMutex();
}
else
{
LowLevelAdapter.SendShowSettingsMessage();
}
}
示例4: Start
public void Start()
{
BrowserThread = new Thread(() =>
{
Browser = new WebBrowser();
Browser.Width = Ballz.The().GraphicsDevice.Viewport.Width;
Browser.Height = Ballz.The().GraphicsDevice.Viewport.Height;
Browser.ScrollBarsEnabled = false;
//Browser.IsWebBrowserContextMenuEnabled = false;
LatestBitmap = new Bitmap(Browser.Width, Browser.Height);
Browser.Validated += (s, e) =>
{
lock (this)
{
Browser.DrawToBitmap(LatestBitmap, new Rectangle(0, 0, Browser.Width, Browser.Height));
}
};
Browser.DocumentCompleted += (s, e) =>
{
lock (this)
{
Browser.DrawToBitmap(LatestBitmap, new Rectangle(0, 0, Browser.Width, Browser.Height));
}
};
Browser.Navigate("file://C:/Users/Lukas/Documents/gui.html");
var context = new ApplicationContext();
Application.Run();
});
BrowserThread.SetApartmentState(ApartmentState.STA);
BrowserThread.Start();
}
示例5: Main
static void Main()
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ApplicationExit += Application_ApplicationExit;
AppContext = new ApplicationContext();
var view = new MainView { Visible = true };
var presenter = new MainPresenter(view);
AppContext.MainForm = null;
AppContext.MainForm = view;
try
{
Bootstrapper.Run();
}
catch (Exception ex)
{
Logger.Error(ex, "App.OnStartup");
return;
}
Application.Run(AppContext);
}
示例6: Main
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
ApplicationContext appCtx = new ApplicationContext(new Form1());
Application.Run(appCtx);
}
示例7: StartApp
/// <summary>
/// Start controlling the application
/// </summary>
public void StartApp()
{
this._NativeResource = Marshal.AllocHGlobal(100);
// Enable XP styles
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
// Setup unhandled exception handlers
AppDomain.CurrentDomain.UnhandledException += // CLR
new UnhandledExceptionEventHandler(OnUnhandledException);
Application.ThreadException += // Windows Forms
new ThreadExceptionEventHandler(OnGuiUnhandedException);
// Create an application Context
this._AppContext = new ApplicationContext();
// Start by showing the main application screen
this.MainView_Show();
// Single instance checked
bool IsFirstInstance;
Mutex theMutex = new Mutex(false, "Local\\Karaokidex", out IsFirstInstance);
/* If IsFirstInstance is now true, we're the first instance of the application;
* otherwise another instance is running.
*/
if (IsFirstInstance)
{
Application.Run(this._AppContext);
}
theMutex.Close();
Application.Exit();
}
示例8: MainForm
public MainForm(ApplicationContext context)
{
_context = context;
InitializeComponent();
btnChangeUsername.Click += (sender, args) => Invoke(ChangeUsername);
}
示例9: init
protected override void init()
{
base.init();
ac = new ApplicationContext();
ac.MainForm = view.mainForm;
}
示例10: LiveSessionTtl
public LiveSessionTtl()
{
channelHandleToSensor = new Dictionary<int, TtlSensor>();
sensorsStarted = 0;
applicationContext = new ApplicationContext();
//Create thread
sessionThread = new Thread(SessionThreadStart);
sessionThread.IsBackground = true;
sessionThread.SetApartmentState(ApartmentState.STA);
//Start thread
bool noTimeout;
sessionThreadInitException = null;
Monitor.Enter(sessionThread);
{
sessionThread.Start();
noTimeout = Monitor.Wait(sessionThread, 5000);
}
Monitor.Exit(sessionThread);
//Check for initialization error
if (sessionThreadInitException != null)
{
throw sessionThreadInitException;
}
else if (!noTimeout)
{
throw new Exception("Initialization timed out!");
}
return;
}
示例11: Main
private static void Main()
{
try
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var frmSplash = new FrmSplash();
//Keep application context
ApplicationContext = new ApplicationContext(frmSplash);
Application.Run(ApplicationContext);
}
catch (Exception)
{
const string briefMsg = "អំពីការចូលទៅក្នុងប្រព័ន្ឋ";
var detailMsg = Resources.MsgConnectionLost;
using (var frmMessageBox = new FrmExtendedMessageBox())
{
frmMessageBox.BriefMsgStr = briefMsg;
frmMessageBox.DetailMsgStr = detailMsg;
frmMessageBox.IsCanceledOnly = true;
frmMessageBox.ShowDialog();
}
}
}
示例12: MainForm
public MainForm(ApplicationContext context)
{
_context = context;
InitializeComponent();
//this.toolStripButtonLoadDestination.Click += (sender, e) => Invoker.Invoke(DestinationInitialize);
this.toolStripButtonLoadDestination.Click += async (sender, e) => await Invoker.InvokeAsync(DestinationInitializeAsync);
//this.buttonLoadSource.Click += (sender, e) => Invoker.Invoke(SourceInitialize);
this.buttonLoadSource.Click += async (sender, e) => await Invoker.InvokeAsync(SourceInitializeAsync);
this.comboBoxSourceTables.SelectionChangeCommitted += (sender, e) =>
{
this.SelectedSourceTableColumns =
(comboBoxSourceTables.SelectedValue as Models.Table).Columns;
};
this.treeView1.AfterSelect += (sender, e) =>
{
if (treeView1.SelectedNode.Tag is Models.Table)
this.SelectedDestinationTableColumns =
(treeView1.SelectedNode.Tag as Models.Table).Columns;
};
this.toolStripButtonDestinationSettings.Click += async (sender, e) => await Invoker.InvokeAsync(DestinationInitializeAsync);
this.buttonImportExecute.Click += async (sender, e) => await Invoker.InvokeAsync(ImportAsync);
}
示例13: ShowSplashForm
public static IDisposable ShowSplashForm(string fileName)
{
if (fileName == null)
throw new ArgumentNullException("fileName");
// The splash image is shown in a different thread to keep the
// splash form responsive.
IDisposable finalizer = null;
using (var @event = new ManualResetEvent(false))
{
var thread = new Thread(() =>
{
var applicationContext = new ApplicationContext(fileName);
finalizer = applicationContext.GetFinalizer();
@event.Set();
Application.Run(applicationContext);
});
thread.SetApartmentState(ApartmentState.STA);
thread.IsBackground = true;
thread.Start();
// Wait for the thread to make the finalizer available.
@event.WaitOne();
}
return finalizer;
}
示例14: Main
static void Main()
{
try
{
Application.ThreadException += new ThreadExceptionEventHandler(ThreadExceptionHandler.Application_ThreadException);
// skinning
SkinManager.EnableFormSkins();
OfficeSkins.Register();
UserLookAndFeel.Default.ActiveLookAndFeel.SkinName = "Office 2010 Blue";
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ApplicationExit += new EventHandler(Application_Exit);
Application_Prepare();
// Spring
ContextRegistry.GetContext();
MainForm.Instance.Show();
TrayNotifier.Instance.UpdateNotifierStartup();
ApplicationContext appContext = new ApplicationContext();
Application.Run(appContext);
}
catch (Exception ex)
{
LoggingHelper.LogError(logger, ex);
MessageBox.Show(ex.ToString(), "Program exception handler");
}
}
示例15: MainView
protected MainView(string name, string configFileName = null)
: base(configFileName)
{
Context = new ApplicationContext(Frame);
Title = name;
Frame.FormClosing += (a, b) => Application.Exit();
}