当前位置: 首页>>代码示例>>C#>>正文


C# Forms.ApplicationContext类代码示例

本文整理汇总了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);
        }
开发者ID:shijiaxing,项目名称:MVPWinFormsDemo,代码行数:7,代码来源:LoginForm.cs

示例2: Main

 static void Main()
 {
     ApplicationContext applicationContext = new ApplicationContext();
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new HostFrom());
 }
开发者ID:flin-aa,项目名称:Windows-Monitoring-Scripts,代码行数:7,代码来源:Program.cs

示例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();
            }
        }
开发者ID:BOOMik,项目名称:dotSwitcher,代码行数:25,代码来源:Program.cs

示例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();
        }
开发者ID:SpagAachen,项目名称:Ballz,代码行数:35,代码来源:GuiRenderer.cs

示例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);
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:29,代码来源:Program.cs

示例6: Main

 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     ApplicationContext appCtx = new ApplicationContext(new Form1());
     Application.Run(appCtx);
 }
开发者ID:mikkellpaulsen,项目名称:Hearthstone-helper,代码行数:7,代码来源:Program.cs

示例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(); 
        }
开发者ID:jzengerling,项目名称:karaokidex,代码行数:38,代码来源:Controller.cs

示例8: MainForm

        public MainForm(ApplicationContext context)
        {
            _context = context;
            InitializeComponent();

            btnChangeUsername.Click += (sender, args) => Invoke(ChangeUsername);
        }
开发者ID:shijiaxing,项目名称:MVPWinFormsDemo,代码行数:7,代码来源:MainForm.cs

示例9: init

        protected override void init()
        {
            base.init();

            ac = new ApplicationContext();
            ac.MainForm = view.mainForm;
        }
开发者ID:kathar,项目名称:KaLibCs,代码行数:7,代码来源:KaController.cs

示例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;
        }
开发者ID:Faham,项目名称:emophiz,代码行数:34,代码来源:LiveSessionTtl.cs

示例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();
                }
            }
        }
开发者ID:ViniciusConsultor,项目名称:campos,代码行数:25,代码来源:FrmSplash.cs

示例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);
        }
开发者ID:Warshavski,项目名称:Importer,代码行数:29,代码来源:MainForm.cs

示例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;
        }
开发者ID:netide,项目名称:netide,代码行数:35,代码来源:SplashForm.cs

示例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");
            }
        }
开发者ID:snowman78,项目名称:jenkins-tray,代码行数:30,代码来源:Program.cs

示例15: MainView

 protected MainView(string name, string configFileName = null)
     : base(configFileName)
 {
     Context = new ApplicationContext(Frame);
     Title = name;
     Frame.FormClosing += (a, b) => Application.Exit();
 }
开发者ID:hahoyer,项目名称:reni.cs,代码行数:7,代码来源:MainView.cs


注:本文中的System.Windows.Forms.ApplicationContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。