當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。