public AlexForm(StartScreen startScreen) { InitializeComponent(); this.startScreen = startScreen; this.CenterToScreen(); // full screen above taskbar //this.MaximizedBounds = Screen.FromHandle(this.Handle).WorkingArea; //this.WindowState = FormWindowState.Maximized; intializeTimers(); // Adding form closing event handler this.FormClosing += new FormClosingEventHandler(CairoAlexDiagram_Closing); fillCollectingPortsList(); try { path = Path.Combine(Environment.CurrentDirectory, @"res"); reportPath = Path.Combine(Environment.CurrentDirectory, @"reports"); greenLEDPath = Path.Combine(path, @"green.png"); redLEDPath = Path.Combine(path, @"red.png"); yellowLEDPath = Path.Combine(path, @"yellow.png"); greyLEDPath = Path.Combine(path, @"grey1.png"); greennLEDPath = Path.Combine(path, @"greenn.png"); } catch (Exception e) { Console.WriteLine(e.Message); MessageBoxButtons buttons = MessageBoxButtons.OK; DialogResult result; // Displays the MessageBox. result = MessageBox.Show(e.Message, "Error", buttons); } finally { nodes = etn.getNetworkNodes(fileName); generateSchemeNodes(nodes); startThread(); } }
public IPsAsListForm(StartScreen startScreen) { InitializeComponent(); this.startScreen = startScreen; this.FormBorderStyle = FormBorderStyle.FixedSingle; ping2.Enabled = false; this.FormClosing += new FormClosingEventHandler(Form_Closing_Handler); // Data t = new Thread(updateStatus); try { path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); path += "\\res"; markPath = path + "\\green_mark.ico"; xPath = path + "\\red_x.ico"; string[] imageFiles = Directory.GetFiles(@path); foreach (var file in imageFiles) { //Add images to Imagelist imageList.Images.Add(Image.FromFile(file)); } } catch (Exception e) { Console.WriteLine(e.Message); MessageBoxButtons buttons = MessageBoxButtons.OK; DialogResult result; // Displays the MessageBox. result = MessageBox.Show(e.Message, "Error", buttons); } }
public CairoSokhnaDiagramForm(StartScreen s) { InitializeComponent(); this.s = s; // full screen above taskbar this.MaximizedBounds = Screen.FromHandle(this.Handle).WorkingArea; this.WindowState = FormWindowState.Maximized; // Adding form closing event handler this.FormClosing += new FormClosingEventHandler(CairoSokhnaDiagram_Closing); t = new Thread(updateStatus); nodes = etn.getNetworkNodes(fileName); try { path = Path.Combine(Environment.CurrentDirectory, @"res"); greenLEDPath = Path.Combine(path, @"green.png"); redLEDPath = Path.Combine(path, @"red.png"); yellowLEDPath = Path.Combine(path, @"yellow.png"); greyLEDPath = Path.Combine(path, @"grey1.png"); string previousNodesName = ""; for (int i = 0; i < nodes.Count(); i++) { // fill ComboBox if (!nodes.ElementAt(i).getName().Equals(previousNodesName)) { comboBox1.Items.Add(new ComboboxItem(nodes.ElementAt(i).getName(), i)); } string ipString = nodes.ElementAt(i).getIP(); nodes.ElementAt(i).sendPing(); int firstDotIndex = ipString.IndexOf("."); int lastDotIndex = ipString.LastIndexOf(".") + 1; int secondDotIndex = ipString.IndexOf(".", ipString.IndexOf(".") + 1); int ipNetworkLength = firstDotIndex; string temp = ipString.Substring(lastDotIndex); if (ipString.Substring(0, firstDotIndex).Equals("10") || ipString.Equals("192.168.1.108") || ipString.Equals("192.168.1.109")) { var control = (PictureBox)this.GetControlByName(this, "p" + temp); var control1 = (Label)this.GetControlByName(this, "l" + temp); control1.Text = ipString; control.Image = Image.FromFile(greyLEDPath); control.SizeMode = PictureBoxSizeMode.Zoom; control.MouseHover += new EventHandler(pictureBoxMouseHoverEventHandler); control.MouseLeave += new EventHandler(pictureBoxMouseLeaveEventHandler); } previousNodesName = nodes.ElementAt(i).getName(); } } catch (Exception e) { Console.WriteLine(e.Message); MessageBoxButtons buttons = MessageBoxButtons.OK; DialogResult result; // Displays the MessageBox. result = MessageBox.Show(e.Message, "Error", buttons); } }