public static void StartAsynchronously(bool killWindowOnRegionCreation, RegionManagerPage page, IConfigSource config, IRegionManagement regionManagement) { Thread t = new Thread(delegate() { try { RegionManager manager = new RegionManager(killWindowOnRegionCreation, page, config, regionManagement); Application.Run(manager); } catch { } }); t.SetApartmentState(ApartmentState.STA); t.Start(); }
public static void StartSynchronously(bool killWindowOnRegionCreation, RegionManagerPage page, IConfigSource config, IRegionManagement regionManagement) { bool done = false; Thread t = new Thread(delegate() { try { RegionManager manager = new RegionManager(killWindowOnRegionCreation, page, config, regionManagement); Application.Run(manager); done = true; } catch { done = true; } }); t.SetApartmentState(ApartmentState.STA); t.Start(); while (!done) Thread.Sleep(100); }
public RegionManager(bool killWindowOnRegionCreation, RegionManagerPage page, IConfigSource config, IRegionManagement regionManagement, RegionInfo startingRegionInfo) { _regionManager = regionManagement; _config = config; _startingRegionInfo = startingRegionInfo; RegionInfo = _startingRegionInfo; KillAfterRegionCreation = killWindowOnRegionCreation; _pageToStart = page; InitializeComponent(); ChangeRegionInfo(_startingRegionInfo); if (_startingRegionInfo == null) groupBox5.Visible = false; tabControl1.SelectedIndex = (int)_pageToStart; changeEstateBox.Visible = false; _timer.Interval = 100; _timer.Tick += m_timer_Tick; _timer.Start (); }
public static void StartSynchronously(bool killWindowOnRegionCreation, RegionManagerPage page, IConfigSource config, IRegionManagement regionManagement) { bool done = false; Thread t = new Thread(delegate() { try { RegionManager manager = new RegionManager(killWindowOnRegionCreation, page, config, regionManagement); Application.Run(manager); done = true; } catch { done = true; } }); t.SetApartmentState(ApartmentState.STA); t.Start(); while (!done) { Thread.Sleep(100); } }
public RegionManager(bool killWindowOnRegionCreation, RegionManagerPage page, IConfigSource config, IRegionManagement regionManagement) { _regionManager = regionManagement; _config = config; KillAfterRegionCreation = killWindowOnRegionCreation; _pageToStart = page; InitializeComponent(); if (page == RegionManagerPage.CreateRegion) { tabControl1.SelectedTab = tabPage2; } else if (page == RegionManagerPage.EstateSetup) { tabControl1.SelectedTab = tabPage3; } changeEstateBox.Visible = false; CStartupType.SelectedIndex = 1; RefreshCurrentRegions(); GetDefaultRegions(); _timer.Interval = 100; _timer.Tick += m_timer_Tick; _timer.Start(); }
public RegionManager(bool killWindowOnRegionCreation, RegionManagerPage page, IConfigSource config, IRegionManagement regionManagement) { _regionManager = regionManagement; _config = config; KillAfterRegionCreation = killWindowOnRegionCreation; _pageToStart = page; InitializeComponent(); if (page == RegionManagerPage.CreateRegion) tabControl1.SelectedTab = tabPage2; else if (page == RegionManagerPage.EstateSetup) tabControl1.SelectedTab = tabPage3; changeEstateBox.Visible = false; CStartupType.SelectedIndex = 1; RefreshCurrentRegions(); GetDefaultRegions (); _timer.Interval = 100; _timer.Tick += m_timer_Tick; _timer.Start (); }
public static RegionInfo StartSynchronously(bool killWindowOnRegionCreation, RegionManagerPage page, IConfigSource config, IRegionManagement regionManagement, RegionInfo startingRegionInfo) { RegionManager manager = null; bool done = false; Thread t = new Thread(delegate() { try { manager = new RegionManager(killWindowOnRegionCreation, page, config, regionManagement, startingRegionInfo); Application.Run(manager); done = true; } catch { done = true; } }); t.SetApartmentState(ApartmentState.STA); t.Start(); while (!done) Thread.Sleep(100); if (manager.RegionInfo == null) { MessageBox.Show("You did not create a region, try again (if you did, make sure you presed the Update button!)"); return StartSynchronously(killWindowOnRegionCreation, page, config, regionManagement, startingRegionInfo); } return manager.RegionInfo; }