System.Windows.Forms.Application.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
		public static void Run ()
		{
			context = new ApplicationContext();
			Run (context);
		}

Same methods

Application::Run ( ApplicationContext context ) : void
Application::Run ( Form mainForm ) : void
Application::Run ( Func
mainForm ) : void
Application::Run ( NSWindow mainForm ) : void

Usage Example

Example #1
0
        private static void Main()
        {
            bool exists = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location)).Length > 1;

            if (exists)
            {
                MessageBox.Show("Программа уже запущена!", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            AppDomain.CurrentDomain.AssemblyResolve += (o, ev) =>
            {
                string folderPath   = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                string assemblyPath = Path.Combine(folderPath, "lib", new AssemblyName(ev.Name).Name);
                if (File.Exists(assemblyPath + ".dll"))
                {
                    return(Assembly.LoadFrom(assemblyPath + ".dll"));
                }
                if (File.Exists(assemblyPath + ".exe"))
                {
                    return(Assembly.LoadFrom(assemblyPath + ".exe"));
                }
                return(null);
            };

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

            Program    program = new Program();
            MainWindow window  = new MainWindow(program);

            window.FormClosing += program.onFormMainClosing;
            Application.Run(window);
        }
All Usage Examples Of System.Windows.Forms.Application::Run