System.Windows.Forms.Application.Run()

Here are the examples of the csharp api class System.Windows.Forms.Application.Run() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

74 Examples 7

1. Example

Project: duplicati
Source File: WinFormsRunner.cs
View license
protected override void Run (string[] args)
        {
            m_trayIcon.Visible = true;
            Application.Run();
        }

2. Example

Project: RiotControl
Source File: Program.cs
View license
public void Run()
		{
			WebService.Run();
			StatisticsService.Run();
			UpdateService.Cleanup();
			if (Configuration.Updates.EnableAutomaticUpdates)
				UpdateService.Run();

			if( !(Configuration.StartMinimised && Configuration.MinimiseToTray) )
				MainWindow.Show();
			System.Windows.Forms.Application.Run();
		}

3. Example

Project: 32feet
Source File: Documentation.cs
View license
public void Discovery2F()
        {
            EventHandler realWork = delegate
            {
                ///...and

                var dlg = new SelectBluetoothDeviceDialog();
                dlg.DeviceFilter = FilterDevice;
                DialogResult result = dlg.ShowDialog();
                if (result != DialogResult.OK) {
                    return;
                }
                BluetoothDeviceInfo device = dlg.SelectedDevice;
                BluetoothAddress addr = device.DeviceAddress;
            };
            /////
            Application.Idle += realWork;
            Application.Run();

        }

4. Example

View license
public void Run()
    {
      Application.Run();
    }

5. Example

Project: Image-Processing-Library
Source File: HSV.cs
View license
private static void ViewColorsForm()
        {
            ViewColors viewColors = new ViewColors();
            viewColors.Show();
            Application.Run();
        }

6. Example

Project: IronAHK
Source File: Application.cs
View license
public static void Run()
        {
            Application.Run();
        }

7. Example

Project: Bdtunnel
Source File: BdtGuiClient.cs
View license
protected override void Run(string[] args)
		{
#pragma warning disable 612,618
			ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
#pragma warning restore 612,618

			LoadConfiguration(args);
			MainComponent = new MainComponent(this);
			Application.Run();
			UnLoadConfiguration();
		}

8. Example

Project: Florence
Source File: InteractiveHost.cs
View license
protected void Run()
        {
            _main_form = new Control();

            // This seems to force the control to actually get a handle,
            // which then makes _main_form.InvokeRequired and _main_form.Invoke()
            // use the thread running this method as the GUI thread, which is 
            // the desired behavior in this case.
            System.IntPtr a = _main_form.Handle;

            Application.Run();
        }

9. Example

Project: Shortcut
Source File: Program.cs
View license
private static void Main()
        {
            System.Console.WriteLine("Run this application and press Ctrl + F");
            _hotkeyBinder.Bind(Modifiers.Control, Keys.F).To(HotkeyCallback);

            // Calling Run is the key to using Shortcut with console applications.
            // 
            Application.Run();
        }

10. Example

Project: Windows-Hacks
Source File: MeltWindow.cs
View license
public static void Run()
        {
            IntPtr hWnd = OtherFunctions.GetFocusedWindow();

            Window.Normalize(hWnd);
            Window.SetFocused(hWnd);
            System.Threading.Thread.Sleep(1000);

            Bitmap screenshot = Desktop.Screenshot();
            screenshot = Tools.Crop(screenshot, new Rectangle(
                Window.GetLocation(hWnd).X,
                Window.GetLocation(hWnd).Y,
                Window.GetSize(hWnd).Width,
                Window.GetSize(hWnd).Height
                ));

            Mask layer = new Mask(hWnd, screenshot);

            // The actual blurring.
            for (int i = 0; i < 10; i++)
            {
                screenshot = Filter.BlurFast(screenshot);
                System.Threading.Thread.Sleep(100);
                layer.Picture.Image = screenshot;
                layer.Picture.Update();
            }

            Window.Close(hWnd);
            System.Threading.Thread.Sleep(100);
            Application.Run();
        }

11. Example

Project: Windows-Hacks
Source File: Thresholder.cs
View license
public static void Run(int thresholds)
        {
            if (thresholds < 1 || thresholds > 255) throw new Exception("Threshold must be 1-255.");

            IntPtr hWnd = OtherFunctions.GetFocusedWindow();

            System.Threading.Thread.Sleep(100);
            Window.SetFocused(hWnd);
            System.Threading.Thread.Sleep(100);
            Bitmap screenshot = Window.Screenshot(hWnd);

            if (thresholds <= 1) screenshot = Effect.Threshold(screenshot);
            else
            {
                int[] array = new int[thresholds];
                int count = 0;
                for (int j = 0; j < array.Length; j++)
                {
                    count += (255 / thresholds);
                    array[j] = count;
                }
                screenshot = Effect.Threshold(screenshot, array);
            }

            Mask mask = new Mask(hWnd, screenshot);
            mask.TransparencyKey = Color.White;
            System.Threading.Thread.Sleep(100);
            Window.Close(hWnd);
            Application.Run();
        }

12. Example

Project: Emby
Source File: MainStartup.cs
View license
private static void ShowTrayIcon(ApplicationHost appHost)
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            _serverNotifyIcon = new ServerNotifyIcon(appHost.LogManager, appHost, appHost.ServerConfigurationManager, appHost.LocalizationManager);
            _mainTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
            Application.Run();
        }

13. Example

Project: Locale-Emulator
Source File: Program.cs
View license
private static void CheckUpdates(string appVer)
        {
            _notifyIcon.Visible = true;

            _notifyIcon.DoubleClick += (sender, e) =>
                                       {
                                           _notifyIcon.Visible = false;
                                           Environment.Exit(0);
                                       };

            ApplicationUpdater.CheckApplicationUpdate(appVer, _notifyIcon);

            Application.Run();
        }

14. Example

Project: audio-switcher
Source File: AudioSwitcherApp.cs
View license
public void Start()
        {
            // Some of the startup services expect, or require a SynchronizationContext, 
            // so we run them after the message loop has started.
            RunOnNextIdle(() => RunStartupServices());

            Application.Idle += OnApplicationIdle;
            Application.Run();
        }

15. Example

View license
private void createFormInOtherThread()
        {
            try
            {
                S7OexchangeBlock fdr = new S7OexchangeBlock();
                _myForm = new _intForm(_connectionHandle, Marshal.SizeOf(fdr), this);
                SetSinecHWndMsg(_connectionHandle, _myForm.Handle, WM_SINEC);
                WndProcReady = true;
                Application.Run();
            }
            catch (ThreadAbortException)
            { }
        }

16. Example

Project: Quick
Source File: Program.cs
View license
[STAThread]
        static void Main()
        {
            if (QuickUpdate.LocalUpdate())
            {
                Environment.Exit(0);
                return;
            }

            if (Init())
            {
                Application.Run();
            }
        }

17. Example

Project: Patchwork
Source File: Program.cs
View license
[STAThread]
		static void Main() {
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			var manager = new LaunchManager();
			manager.Command_Start();
			Application.Run();
		}

18. Example

Project: Windows-Hacks
Source File: Inverter.cs
View license
public static void Run()
        {
            IntPtr hWnd = OtherFunctions.GetFocusedWindow();

            Window.Normalize(hWnd);
            Window.SetFocused(hWnd);
            System.Threading.Thread.Sleep(1000);

            Bitmap screenshot = Desktop.Screenshot();
            screenshot = Tools.Crop(screenshot, new Rectangle(
                Window.GetLocation(hWnd).X,
                Window.GetLocation(hWnd).Y,
                Window.GetSize(hWnd).Width,
                Window.GetSize(hWnd).Height
                ));

            screenshot = Effect.Invert(screenshot);
            Mask layer = new Mask(hWnd, screenshot);
            Window.Close(hWnd);
            System.Threading.Thread.Sleep(100);
            screenshot.Dispose();
            Application.Run();
        }

19. Example

Project: Windows-Hacks
Source File: Shrinker.cs
View license
public static void Run()
        {
            IntPtr hWnd = OtherFunctions.GetFocusedWindow();

            Window.Normalize(hWnd);
            Window.SetFocused(hWnd);
            System.Threading.Thread.Sleep(1000);

            Bitmap screenshot = Desktop.Screenshot();
            screenshot = Tools.Crop(screenshot, new Rectangle(
                Window.GetLocation(hWnd).X,
                Window.GetLocation(hWnd).Y,
                Window.GetSize(hWnd).Width,
                Window.GetSize(hWnd).Height
                ));

            Mask layer = new Mask(hWnd, screenshot);

            Window.Close(hWnd);

            System.Threading.Thread.Sleep(100);

            Bitmap resized = new Bitmap(screenshot);
            for (double i = 1; i > 0.1; i -= 0.02)
            {
                resized.Dispose();
                resized = Tools.Resize(
                    screenshot,
                    (int)(screenshot.Width * i),
                    (int)(screenshot.Height * i)
                    );
                layer.Picture.Image = resized;
                layer.Size = resized.Size;
                layer.Picture.Update();
                layer.Location = new Point(
                    layer.Location.X + (int)(screenshot.Width * 0.02 / 2),
                    layer.Location.Y + (int)(screenshot.Height * 0.02 / 2)
                    );
                System.Threading.Thread.Sleep(10);
            }

            Application.Run();
        }

20. Example

Project: SpotifyStatusApplet
Source File: Program.cs
View license
private void setupTrayIcon()
        {
            var myThread = new Thread(delegate()
            {
                using (AppTrayIcon ati = new AppTrayIcon(this))
                {
                    ati.Display();
                    Application.Run();
                }
            });

            myThread.SetApartmentState(ApartmentState.STA);
            myThread.Start();
        }

21. Example

Project: roslyn
Source File: InteractiveHost.Service.cs
View license
private static void UIThread()
            {
                s_ui = new Control();
                s_ui.CreateControl();

                s_uiReady.Set();
                Application.Run();
            }

22. Example

Project: mwinapi
Source File: Program.cs
View license
[STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            new MainForm();
            Application.Run();
        }

23. Example

Project: ServerFramework.NET
Source File: Program.cs
View license
[STAThread]
        static void Main()
        {
            /*
             * Create a server.
             * There are 4 constructors to choose from
             */
            Server server = new Server(port: 80, messageDelimiters: new List<char> { '\n', '\r' });
            server.OnMessageReceived += server_OnMessageReceived; 
            server.OnTooManyClients += server_OnTooManyClients;
            server.OnClientConnect += server_OnClientConnect;
            server.OnClientDisconnect += (o, i) => Console.WriteLine("Client disconnected");
            server.OnServerStop += (o, i) => 
            {
                Console.WriteLine("Server stopped");
                Application.Exit();
            };
            server.StartAsync();
            Application.Run();
        }

24. Example

Project: Gorgon
Source File: Gorgon.cs
View license
public static void Run(Func<bool> loop)
		{
			if (loop == null)
			{
				throw new ArgumentNullException("loop");
			}

			if (IsRunning)
			{
			    throw new InvalidOperationException(Resources.GOR_APPLICATION_ALREADY_RUNNING);
			}

			ApplicationIdleLoopMethod = loop;

			try
			{
				if (Initialize())
				{
					return;
				}

				IsRunning = true;
                _timingStarted = true;
				Application.Run();
			}
			catch (Exception ex)
			{
				GorgonException.LogException(ex);
				throw;
			}
			finally
			{
				CleanUp();
			}
		}

25. Example

Project: PS3BluMote
Source File: Program.cs
View license
[STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            SettingsForm frmSettings = new SettingsForm();

            Application.Run();

            frmSettings.Dispose();
        }

26. Example

Project: ClearCanvas
Source File: GuiToolkit.cs
View license
public void Run()
        {
        	_guiThread = Thread.CurrentThread;

        	Application.CurrentUICultureChanged += Application_CurrentUICultureChanged;

            // this must be called before any GUI objects are created - otherwise we get problems with icons not showing up
            System.Windows.Forms.Application.EnableVisualStyles();

            // create a timer to raise the Started event from the message pump
            System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
            timer.Interval = 100;
            timer.Tick += delegate(object sender, EventArgs args)
            {
                // immediately disable the timer so we don't get a second Tick
                timer.Dispose();
                EventsHelper.Fire(_started, this, EventArgs.Empty);
            };
            timer.Enabled = true;

            // start the message pump
            System.Windows.Forms.Application.Run();
        }

27. Example

Project: Taskplay
Source File: Program.cs
View license
[STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
     /n ..... /n //View Source file for more details /n }

28. Example

Project: fomm
Source File: dxmut.cs
View license
public void MainLoop()
        {
            // No need to do anything if the framework is already d/n ..... /n //View Source file for more details /n }

29. Example

Project: fog-client
Source File: Tray.cs
View license
[STAThread]
        public static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            bool isFirstInstance;
            using (new Mutex(true, "FOG-TRAY", out isFirstInstance))
            {
                if (!isFirstInstance) return;
                var notificationIcon = new NotificationIcon();
                notificationIcon._notifyIcon.Visible = true;
                Application.Run();
                notificationIcon._notifyIcon.Dispose();
            }
        }

30. Example

Project: Disco
Source File: Program.cs
View license
[STAThread]
        static void Main(string[] args)
        {
            Application.ThreadExceptio/n ..... /n //View Source file for more details /n }

31. Example

Project: gInk
Source File: Program.cs
View license
[STAThread]
		static void Main()
		{
			Application.ThreadException += new ThreadExceptionEventHandler(UIThreadException);
			Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
			AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledException);

			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);

			new Root();
			Application.Run();
		}

32. Example

Project: Windows-Hacks
Source File: Scrambler.cs
View license
public static void Run()
        {
            IntPtr hWnd = OtherFunctions.GetFocusedWindow();

            Window.Normalize(hWnd);
            Window.SetFocused(hWnd);
            System.Threading.Thread.Sleep(1000);

            Bitmap screenshot = Desktop.Screenshot();
            screenshot = Tools.Crop(screenshot, new Rectangle(
                Window.GetLocation(hWnd).X,
                Window.GetLocation(hWnd).Y,
                Window.GetSize(hWnd).Width,
                Window.GetSize(hWnd).Height
                ));

            mask = new Mask(hWnd, screenshot);
            Window.Close(hWnd);
            LoadWidth(0, mask.Width-1);
            LoadHeight(0, mask.Height-1);
            Application.Run();
            //Display();
        }

33. Example

View license
private Thread StartUIThread()
        {
            // Start a new UI thread to run the browser dia/n ..... /n //View Source file for more details /n }

34. Example

View license
private Thread StartUIThread()
        {
            // Start a new UI thread to run the browser dialog on so that we can block this one and present
            // a synchronous interface to callers.
            Thread uiSubThread = new Thread(
                () =>
                {
                    try
                    {
                        this.formsSyncContext = new WindowsFormsSynchronizationContext();

                        this.dialog = new SilentWindowsFormsAuthenticationDialog(this.OwnerWindow)
                        {
                            NavigationWaitMiliSecs = NavigationWaitMiliSecs
                        };

                        this.dialog.Done += this.UIDoneHandler;

                        this.threadInitializedEvent.Set();

                        this.dialog.AuthenticateAAD(this.RequestUri, this.CallbackUri);

                        // Start and turn control over to the message loop.
                        Application.Run();

                        this.result = this.dialog.Result;
                    }
                    catch (Exception e)
                    {
                        // Catch all exceptions to transfer them to the original calling thread.
                        this.uiException = e;
                    }
                });

            uiSubThread.SetApartmentState(ApartmentState.STA);
            uiSubThread.IsBackground = true;
            uiSubThread.Start();

            return uiSubThread;
        }

35. Example

Project: Unigram
Source File: Program.cs
View license
static void Main(string[] args)
        {
            Thread appServiceThread = new Thread(new ThreadStart(ThreadProc));
            appServiceThread.Start();

            // Just for debug pourposes
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("*****************************");
            Console.WriteLine("**** Classic desktop app ****");
            Console.WriteLine("*****************************");
            Console.ReadLine();

            Application.Run();
        }

36. Example

Project: Cropper
Source File: Program.cs
View license
[STAThread]
        private static void Main()
        {
            bool isFirstInstance;
            Mutex mutex = new Mutex(false, "Local\\Cropper", out isFirstInstance);
            if (Configuration.Current.AllowMultipleInstances || isFirstInstance)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                MainCropForm mainCropForm = new MainCropForm();

                mainCropForm.Closed += HandleMainCropFormClosed;
                Application.Run();
                GC.KeepAlive(mutex);
            }
        }

37. Example

View license
private void ViewHistogramForm()
        {
            double highestValue = GetHighestValue();

            ViewHistogram viewRed = new ViewHistogram(GetRed(), highestValue, Color.Red);
            viewRed.Show();

            ViewHistogram viewGreen = new ViewHistogram(GetGreen(), highestValue, Color.Green);
            viewGreen.Show();

            ViewHistogram viewBlue = new ViewHistogram(GetBlue(), highestValue, Color.Blue);
            viewBlue.Show();

            Application.Run();
        }

38. Example

Project: NegativeScreen
Source File: Program.cs
View license
[STAThread]
		static void Main(string[] args)
		{
			AppDomain.CurrentDomain.UnhandledException += n/n ..... /n //View Source file for more details /n }

39. Example

View license
private void BackgroundMain()
            {
                try
                {
                    using (form = new Form())
                    {
                        form.Size = new Size(browserWidth, browserHeight);

                        browser = new ExplorerBrowserControl();
                        browser.Dock = DockStyle.Fill;
                        browser.Silent = true;
                        browser.DocumentComplete += Handler;
                        form.Controls.Add(browser);
                        form.CreateControl();
                        browser.Navigate(url);

                        Application.Run();
                    }
                }
                catch (Exception e)
                {
                    Trace.Fail(e.ToString());
                }
            }

40. Example

Project: ttaudio
Source File: Program.cs
View license
[STAThread]
        static void Main(string[] args)
        {
            log.Info(About.Info);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            int openWindows = 0;
            if (args.Any())
            {
                foreach (var file in args)
                {
                    try
                    {
                        Editor.Open(file);
                        ++openWindows;
                    }
                    catch
                    {
                    }
                }
            }

            if (openWindows == 0)
            {
                Editor.New();
            }

                Application.Run();
        }

41. Example

Project: server
Source File: UlteriusTray.cs
View license
public static void ShowTray()
        {
            RefreshTrayArea();
            Menu = new Contex/n ..... /n //View Source file for more details /n }

42. Example

Project: AdaptiveTaskbar
Source File: Program.cs
View license
private static void Main(string[] args)
        {
#if DEBUG
            //SetStartup(true); // For testing
            //UpdateApp(); // For testing
#else
            // Customize Squirrel update events (this also prevents shortcuts from being created as happens in the default implementation)
            using (var updateManager = new UpdateManager(""))
            {
                SquirrelAwareApp.HandleEvents(
                  onInitialInstall: v => SetStartup(false),
                  onAppUpdate: v => SetStartup(false),
                  onAppUninstall: v => SetStartup(true),
                  onFirstRun: () => MessageBox.Show(ON_FIRST_RUN_DESCRIPTION, ON_FIRST_RUN_TITLE));
            }

            UpdateApp();
#endif

            // Read custom BIG_TASKBAR_RES setting from App.config
            try
            {
                BIG_TASKBAR_RES = Int32.Parse(ConfigurationManager.AppSettings["BIG_TASKBAR_RES"]);
            }
            catch (Exception)
            {
            }

            SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged; // We are never detaching the event handler
            SystemEvents_DisplaySettingsChanged(null, null);
            //ToggleTaskbarSize(); // For testing

            Application.Run(); // Blocking. This prevents the application from closing.
        }

43. Example

Project: kcptun-gui-windows
Source File: Program.cs
View license
[STAThread]
        static void Main()
        {
            Directory.SetCurrentDirectory(Application.StartupPath);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!Logging.OpenLogFile())
            {
                MessageBox.Show(string.Format(I18N.GetString("Can't access the file '{0}', it is maybe used by another process."), Logging.LogFilePath),
                    I18N.GetString("Error"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            controller = new MainController();
            MenuViewController viewController = new MenuViewController(controller);
            controller.Start();
            Application.ApplicationExit += Application_ApplicationExit;
            SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
            Application.Run();
        }

44. Example

Project: HideVolumeOSD
Source File: Program.cs
View license
[STAThread]
		static void Main(string[] args)
		{
			if (mutex.WaitOne(TimeSpan.Zero, true))
			{
				if ((args.GetLength(0) == 1))
				{
					HideVolumeOSDLib lib = new HideVolumeOSDLib(null);

					lib.Init();

					if (args[0] == "-hide")
					{
						lib.HideOSD();
					}
					else
						if (args[0] == "-show")
						{
							lib.ShowOSD();
						}
				}
				else
				{
					Application.EnableVisualStyles();
					Application.SetCompatibleTextRenderingDefault(false);

					using (ProcessIcon pi = new ProcessIcon())
					{
						pi.Display();

						if (!InitFailed)
							Application.Run();
					}
				}

				mutex.ReleaseMutex();
			}
		}

45. Example

Project: CubePdf
Source File: Program.cs
View license
[STAThread]
        static void Main(string[] args)
        {
            Application.EnableVisualSt/n ..... /n //View Source file for more details /n }

46. Example

Project: PeanutButter
Source File: TestTrayIcon.cs
View license
[Test]
        [STAThread]
        [Explicit("Should be run manually; this is an interactive UI test/n ..... /n //View Source file for more details /n }

47. Example

Project: 32feet
Source File: BluetoothWin32Events.cs
View license
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
            Justification = "Is rethrown on the creator.")]
        void MessageLoop_Runner(object state)
        {
            try {
                ApartmentState a = _formThread.GetApartmentState();
                Debug.Assert(a == ApartmentState.STA, "!STA!");
                CreateForm();
                //form.Show(); // Not necessary -- enable for debugging only.
                _inited.Set(); // Initial success
                Application.Run();
            } catch (Exception ex) {
                _formThreadException = ex;
                Thread.MemoryBarrier();
            } finally {
                if (_form != null)
                    _form.Dispose();
                if (_inited != null)
                    _inited.Set();
            }
        }

48. Example

Project: ShadowsocksR-Csharp
Source File: Program.cs
View license
[STAThread]
        static void Main(string[] args)
        {
#if !_CONSOLE
            foreach (str/n ..... /n //View Source file for more details /n }

49. Example

Project: shadowsocksr-csharp
Source File: Program.cs
View license
[STAThread]
        static void Main(string[] args)
        {
#if !_CONSOLE
            foreach (str/n ..... /n //View Source file for more details /n }

50. Example

Project: shadowsocksr-csharp
Source File: Program.cs
View license
[STAThread]
        static void Main(string[] args)
        {
#if !_CONSOLE
            foreach (str/n ..... /n //View Source file for more details /n }