Inheritance: MonoMac.AppKit.NSApplicationDelegate
Beispiel #1
0
        protected override void init()
        {
            base.init();

            ac = new ApplicationContext();
            ac.MainForm = view.mainForm;
        }
Beispiel #2
0
        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();
                }
            }
        }
        public LoginForm(ApplicationContext context)
        {
            _context = context;
            InitializeComponent();

            btnLogin.Click += (sender, args) => Invoke(Login);
        }
Beispiel #4
0
        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");
            }
        }
        public void FormCommit_Form1()
        {
            app = new ApplicationContext();
            var currentDir = Directory.GetCurrentDirectory();
            string[] args = new string[] { "", "", currentDir };    // GitExtensionsTest\bin\Debug
            if (args[2].EndsWith(@"bin\Debug"))
                args[2] = Path.GetFullPath(currentDir + @"\..\..\..");

            var dir = RevisionGridTest.GetWorkingDir(args);
            Directory.SetCurrentDirectory(dir);

            GitUICommands uCommands = new GitUICommands(dir);

            Form = new FormCommitTest(uCommands);

            Unstaged = Form.ListUnstaged;
            Staged = Form.ListStaged;

            app.MainForm = Form;

            var browseForm = TestStatic.StartBrowseForm(uCommands, Form);

            Form.LoadModule(browseForm.Module);

            this.Unstaged.Subscribe();
            this.Staged.Subscribe();

            Form.Shown += Form_Shown;

            Form.Show();

            Application.Run(app);
        }
Beispiel #6
0
        public MainForm(ApplicationContext context)
        {
            _context = context;
            InitializeComponent();

            btnChangeUsername.Click += (sender, args) => Invoke(ChangeUsername);
        }
Beispiel #7
0
        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);
        }
        /// <summary>
        /// Creates the DI container for the application.
        /// </summary>
        /// <param name="context">The application context that controls when the application will terminate.</param>
        /// <param name="storageDirectory">The directory in which all the uploaded files are stored.</param>
        /// <returns>The DI container.</returns>
        public static IContainer CreateContainer(ApplicationContext context, string storageDirectory)
        {
            var builder = new ContainerBuilder();
            {
                builder.RegisterInstance(context)
                    .As<ApplicationContext>()
                    .ExternallyOwned()
                    .SingleInstance();

                builder.RegisterModule(new UtilitiesModule());
                builder.RegisterModule(
                    new CommunicationModule(
                        new List<CommunicationSubject>
                            {
                                CommunicationSubjects.TestTransfer,
                                CommunicationSubjects.TestExecution,
                            },
                        new List<ChannelType>
                            {
                                ChannelType.NamedPipe,
                                ChannelType.TcpIP,
                            },
                        true));

                RegisterFileSystem(builder);
                RegisterReports(builder);
                RegisterInformation(builder);
                RegisterNotifications(builder);
                RegisterCommands(builder, storageDirectory);
            }

            return builder.Build();
        }
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     ApplicationContext appCtx = new ApplicationContext(new Form1());
     Application.Run(appCtx);
 }
Beispiel #10
0
        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;
        }
Beispiel #11
0
        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;
        }
Beispiel #12
0
		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);
		}
Beispiel #13
0
        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();
        }
Beispiel #14
0
 protected MainView(string name, string configFileName = null)
     : base(configFileName)
 {
     Context = new ApplicationContext(Frame);
     Title = name;
     Frame.FormClosing += (a, b) => Application.Exit();
 }
Beispiel #15
0
        /// <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(); 
        }
        public LoginStudentForm(ApplicationContext context)
        {
            _context = context;
            InitializeComponent();

            btnStartTest.Click += (sender, args) => Invoke(this.StartTest);
            this.Closed += (sender, args) => Invoke(this.ContextDispose);
        }
Beispiel #17
0
 /// <summary>
 /// Создает форму редактора мероприятий
 /// </summary>
 public EventsEditor(ApplicationContext context)
 {
     _context = context;
     //this.connstr = Connstr;
     InitializeComponent();
     //this.queriesTableAdapter = new sportapp.sportDataSetTableAdapters.QueriesTableAdapter();
     this.MdiParent = _context.MainForm;
 }
Beispiel #18
0
 public override void RunApplication()
 {
     if (SwfApplicationContext == null)
     {
         SwfApplicationContext = new SWF.ApplicationContext();
     }
     SWF.Application.Run(SwfApplicationContext);
 }
Beispiel #19
0
        /// <summary>
        /// Создает новую форму информации о текущих мероприятиях
        /// </summary>
        public CurrentEvents(ApplicationContext context)
        {
            _context = context;

            InitializeComponent();

            this.MdiParent = _context.MainForm;
        }
 internal void StartListening()
 {
     ApplicationContext ctx = new ApplicationContext();
     CreateParams cp = new CreateParams();
     cp.Parent = (IntPtr)(-3); //Without this, WndProc will also intercept messages delivered to regular windows forms
     this.CreateHandle(cp);
     Application.Run(ctx);
 }
Beispiel #21
0
        public Dressings(ApplicationContext context)
        {
            _context = context;

            InitializeComponent();

            this.MdiParent = _context.MainForm;
        }
Beispiel #22
0
 public static void Run(ApplicationContext context)
 {
     if (IsFirstInstance())
     {
         Application.ApplicationExit += new EventHandler(OnExit);
         Application.Run(context);
     }
 }
        public MainForm(ApplicationContext context)
        {
            _context = context;

            InitializeComponent();

            listBox1.DoubleClick += (sender, args) => Invoke(ExpandChannel);
        }
 static void Main(string[] args)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     var form = new MainMenuForm ();
     aContext = new ApplicationContext (form);
     Application.Run(aContext);
 }
Beispiel #25
0
        /// <summary>
        /// Создает форму информации о тренерах
        /// </summary>
        public TrainersInfo(ApplicationContext context)
        {
            _context = context;

            InitializeComponent();

            this.MdiParent = _context.MainForm;
        }
Beispiel #26
0
        public TestView(ApplicationContext context)
        {
            _context = context;

            InitializeComponent();

            this.MdiParent = _context.MainForm;
        }
Beispiel #27
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var context = new ApplicationContext();
            var loginForm = new LoginForm(new Services.Implementation.LoginService(), new ApplicationContext());
            loginForm.Run();
        }
Beispiel #28
0
 public MainForm(ApplicationContext ac)
 {
     this.ac = ac;
     instance = this;
     InitializeComponent();
     SetHotkeysEnabled(true);
     LoadServerList();
     fetchClipboardEntry();
 }
        /// <summary>
        /// Creates the DI container.
        /// </summary>
        /// <param name="context">The application context that controls the life time of the application.</param>
        /// <returns>The DI container.</returns>
        public static IContainer Load(ApplicationContext context)
        {
            IContainer result = null;
            var builder = new ContainerBuilder();
            {
                builder.Register(c => new XmlConfiguration(
                        CommunicationConfigurationKeys.ToCollection()
                            .Append(DiagnosticsConfigurationKeys.ToCollection())
                            .ToList(),
                        DatasetApplicationConstants.ConfigurationSectionApplicationSettings))
                    .As<IConfiguration>();

                builder.Register(c => new FileSystem())
                    .As<IFileSystem>();

                // Don't allow discovery on the dataset application because:
                // - The dataset application wouldn't know what to do with it anyway
                // - We don't want anybody talking to the application except for the
                //   application that started it.
                builder.RegisterModule(
                    new CommunicationModule(
                        new List<CommunicationSubject>
                            {
                                CommunicationSubjects.Dataset,
                                CommunicationSubjects.Plugins,
                            },
                        new[]
                            {
                                ChannelType.NamedPipe,
                            },
                        false));

                RegisterCommands(
                    builder,
                    () => CloseApplication(result),
                    file => LoadDatasetFile(result, file));
                RegisterNotifications(builder);

                builder.Register(c => context)
                    .As<ApplicationContext>()
                    .As<IDisposable>()
                    .ExternallyOwned();

                RegisterLoggers(builder);
                RegisterProfiler(builder);
                RegisterDiagnostics(builder);
                RegisterScheduleStorage(builder);
                RegisterTimeline(builder);
                RegisterScheduleExecutors(builder);
                RegisterPartStorage(builder);
                RegisterDatasetLock(builder);
                RegisterAssemblyResolver(builder);
            }

            result = builder.Build();
            return result;
        }
Beispiel #30
0
 /// <summary>
 /// Execute a form base application if another instance already running on
 /// the system activate previous one
 /// </summary>
 /// <param name="context">context</param>
 /// <returns>true if no previous instance is running</returns>
 public static bool Run(System.Windows.Forms.ApplicationContext context, System.Windows.Forms.ApplicationContext context2)
 {
     try
     {
         if (IsAlreadyRunning())
         {
             Application.Run(context2);
             return(false);
         }
         Application.Run(context);
         return(true);
     }
     catch (Exception ex)
     {
         log.Error("Exception: " + ex);
         throw new Exception(ex.Message);
     }
 }
Beispiel #31
0
 /// <summary>
 /// Execute a form base application if another instance already running on
 /// the system activate previous one
 /// </summary>
 /// <param name="context">context</param>
 /// <returns>true if no previous instance is running</returns>
 public static bool Run(System.Windows.Forms.ApplicationContext context)
 {
     try
     {
         if (IsAlreadyRunning())
         {
             //set focus on previously running app
             SwitchToCurrentInstance();
             return(false);
         }
         Application.Run(context);
         return(true);
     }
     catch (Exception ex)
     {
         log.Error("Exception: " + ex);
         throw new Exception(ex.Message);
     }
 }
Beispiel #32
0
        public void MainLoop()
        {
            var context = new System.Windows.Forms.ApplicationContext(this);

            context.MainForm.Visible = true;

            var openAdapter        = new D3DKMT_OPENADAPTERFROMHDC();
            var waitForVblankEvent = new D3DKMT_WAITFORVERTICALBLANKEVENT();

            openAdapter.hDc = CreateDC(Screen.PrimaryScreen.DeviceName, null, null, IntPtr.Zero);

            bool   useD3DKMT  = false;
            double targetTime = 1.0 / 60;

            if (D3DKMTOpenAdapterFromHdc(ref openAdapter) == 0)
            {
                useD3DKMT = true;
                waitForVblankEvent.hAdapter      = openAdapter.hAdapter;
                waitForVblankEvent.hDevice       = 0;
                waitForVblankEvent.VidPnSourceId = openAdapter.VidPnSourceId;
            }
            else
            {
                var mode = new DEVMODE();
                if (EnumDisplaySettings(null, ENUM_CURRENT_SETTINGS, ref mode) && mode.dmBitsPerPel > 0)
                {
                    targetTime = 1.0 / mode.dmDisplayFrequency;
                }
            }

            while (!IsDisposed)
            {
                var msg = new MSG();
                while (PeekMessage(ref msg, IntPtr.Zero, 0, 0, 0x0001 /*PM_REMOVE*/))
                {
                    TranslateMessage(ref msg);
                    DispatchMessage(ref msg);
                }

                if (useD3DKMT)
                {
                    D3DKMTWaitForVerticalBlankEvent(ref waitForVblankEvent);

                    if (!_control.OnRender())
                    {
                        return;
                    }
                }
                else
                {
                    var startTime = Clock.GetSeconds();

                    if (!_control.OnRender())
                    {
                        return;
                    }

                    var renderTime = Clock.GetSeconds() - startTime;
                    var msTimeout  = (int)((targetTime - renderTime) * 1000.0 + 0.5);

                    if (msTimeout > 0)
                    {
                        Thread.Sleep(msTimeout);
                    }
                }
            }
        }
Beispiel #33
0
 public static void Run(System.Windows.Forms.Form form)
 {
     Context_ = new ApplicationContext(form);
     System.Windows.Forms.Application.Run(Context_);
 }
 static void Main()
 {
     ApplicationContext applicationContext = new ApplicationContext();
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new HostFrom());
 }
Beispiel #35
-1
        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();
            }
        }