/// <summary> /// Initialize the Macomber Map /// </summary> /// <param name="Coordinates">The coordinates to be used in the map</param> /// <param name="Starter">Our startup form</param> public MacomberMap_Form(MM_Coordinates Coordinates, MM_Startup_Form Starter) { InitializeComponent(); var size = ClientSize; this.Size = Screen.PrimaryScreen.WorkingArea.Size; if (this.Size.Width >= 1900) { size = new Size(1900, this.Size.Height); } if (this.Size.Height >= 1200) { size = new Size(this.Size.Width, 1180); } this.ClientSize = new Size(size.Width - 10, size.Height - 10); this.Size = ClientSize; this.Title = "Main Map"; this.Starter = Starter; MM_System_Interfaces.LogError("MM: Initializing network map/coordinates"); InitNetworkMap(Coordinates); if (!Data_Integration.Permissions.ShowViolations) { SwitchMMView(false, false); } //Assign our integration layer, add the thread and form to it Data_Integration.RunningForms.Add(this); Data_Integration.RunningThreads.Add(System.Threading.Thread.CurrentThread); System.Threading.Thread.Sleep(3000); // wait for model kv levels to load //Assign our controls MM_System_Interfaces.LogError("MM: Starting network map"); ctlNetworkMap.SetControls(ctlViolationViewer, 0); MM_System_Interfaces.LogError("MM: Starting violation viewer"); ctlViolationViewer.SetControls(ctlNetworkMap); MM_System_Interfaces.LogError("MM: Starting key indicators"); ctlKeyIndicators.SetControls(ctlNetworkMap, ctlViolationViewer, MM_Repository.xConfiguration.DocumentElement["DisplayParameters"]["KeyIndicators"]); ResizeLeftSlider(this, null); //Set up our results helper ResultsHelper = new MM_Search_Results_Helper(); ResultsHelper.Visible = false; Controls.Add(ResultsHelper); ResultsHelper.BringToFront(); (this.FindForm() as MacomberMap_Form).ctlKeyIndicators.AssignResultsHelper(ResultsHelper); //Set up our main timer Program.MainFormChecker = new System.Threading.Timer(Program.ThreadChecker, System.Threading.Thread.CurrentThread, 15000, 15000); StartRender(); }
static void Main(params string[] args) { // CreateModelXml user password filepath (Build thMM_System_Interfacesis as a console app for this job). if (args.Length > 0 && args[0].Equals("CreateModelXml", StringComparison.OrdinalIgnoreCase)) { try { System.Console.Error.WriteLine("Starting XML Model creator client"); MM_Server_Interface.LoadModelFromSql = true; MM_System_Interfaces.Headless = true; MM_Repository.OverallDisplay = new MM_Display(); MM_Coordinates coord = new MM_Coordinates(-109f, 29f, -86f, 51f, 1f); System.Console.Error.WriteLine("Waiting for server..."); while (MM_Server_Interface.MMServers == null || MM_Server_Interface.MMServers.Count == 0) { Thread.Sleep(3000); } var list = MM_Server_Interface.MMServers.Values.ToList(); System.Console.Error.WriteLine("Connecting to server: " + list[0].ServerName); string user = "******"; string password = ""; string file = "MacomberMap-Combined.MM_Model"; if (args.Length > 1) { if (args[1].EndsWith(".MM_Model")) { file = args[1]; } else { user = args[1]; } } if (args.Length > 2) { if (args[2].EndsWith(".MM_Model")) { file = args[2]; } else { password = args[2]; } } if (args.Length > 3) { file = args[3]; } Exception exp = new Exception(); MM_Server_Interface.TryLogin(list[0].ServerName, list[0].ServerURI, user, password, out exp); MM_Server_Interface.LoadMacomberMapConfiguration(); Data_Integration.InitializationComplete = false; System.Console.Error.WriteLine("Starting SQL Model Loader..."); SqlModelLoader sqlModelLoader = new SqlModelLoader(); sqlModelLoader.ConnectionString = Settings.Default.ModelDatabase; sqlModelLoader.LoadStaticRepository(); System.Console.Error.WriteLine("Rolling up Elements..."); Data_Integration.UseEstimates = false; Data_Integration.RollUpElementsToSubstation(); Data_Integration.CommLoaded = true; Data_Integration.ModelLoadCompletion = DateTime.Now; Data_Integration.NetworkSource = new MM_Data_Source(); Data_Integration.NetworkSource.Estimates = false; Data_Integration.NetworkSource.Database = "NETMOM"; Data_Integration.NetworkSource.Application = "RTNET"; Data_Integration.NetworkSource.BackColor = Color.Blue; Data_Integration.NetworkSource.Telemetry = true; Data_Integration.NetworkSource.Default = true; Data_Integration.NetworkSource.Master = true; Data_Integration.NetworkSource.ViolationApp = "RTCA"; Data_Integration.InitializationComplete = true; // Data_Integration.RestartModel(MM_Server_Interface.Client); Data_Integration.SaveXMLData(file, coord); System.Console.WriteLine("Waiting for data..."); for (int i = 0; i < 60 * 8; i++) { System.Console.Write("."); Thread.Sleep(1000); // wait for EMS data to flow in. } Data_Integration.SaveXMLData(file, coord); } catch (Exception ex) { System.Console.Error.WriteLine(ex.Message); System.Console.Error.WriteLine(ex.StackTrace); System.Environment.Exit(1); } System.Environment.Exit(0); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ThreadException += Application_ThreadException; // Application.Run(new frmControlTester()); // return; try { Microsoft.Win32.RegistryKey key; key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("Policies", true); if (!key.GetSubKeyNames().Contains("Chromium")) { key.CreateSubKey("Chromium"); } key = key.OpenSubKey("Chromium", true); if (!key.GetSubKeyNames().Contains("EnabledPlugins")) { key.CreateSubKey("EnabledPlugins"); } key = key.OpenSubKey("EnabledPlugins", true); if (!key.GetValueNames().Contains("1")) { key.SetValue("1", "Silverlight*"); key.SetValue("2", "npapi"); } } catch (Exception ex) { MM_System_Interfaces.LogError(ex); } if (Environment.CommandLine.IndexOf("/Test", StringComparison.CurrentCultureIgnoreCase) != -1) { Application.Run(new frmTest()); } else { using (MM_Startup_Form Startup = new MM_Startup_Form()) if (Startup.ShowDialog(StartNetworkMap) == DialogResult.OK) { Application.Run(); } else { Application.Exit(); } } }