public ObjectOptionsForm(xObject obj) { InitializeComponent(); Text = Options.LangCur.lEOTitle + " " + Options.LangCur.lEETitleObject; // Share lblReference.Text = Options.LangCur.lEOReference; lblName.Text = Options.LangCur.lEOName; toolTip.SetToolTip(btnGetReference, Options.LangCur.hEOGetReference); // Own toolTip.SetToolTip(btnIPAdd, Options.LangCur.hOOIPAdd); toolTip.SetToolTip(btnIPEdit, Options.LangCur.hOOIPEdit); toolTip.SetToolTip(btnIPDelete, Options.LangCur.hOOIPDelete); clmIP.Text = Options.LangCur.lOOColumIP; clmPeriod.Text = Options.LangCur.lOOColumPeriod; clmTimeNext.Text = Options.LangCur.lOOColumTimeNext; clmTimeLast.Text = Options.LangCur.lOOColumTimeLast; clmLastResult.Text = Options.LangCur.lOOColumResult; // Store Object = obj; if (Object == null) { btnIPAdd.Enabled = false; btnOk.Enabled = false; return; } // Fill tbReference.Text = Object.Reference; tbName.Text = Object.Name; tbDescription.Text = Object.Description; // Fill IPs foreach (var IP in obj.IPs) { Share.lvIPs_Add(lvIPs, IP, ref IP.Obj_lvItem); } }
private void UpdateObjectNode(ListViewItem lvItem, xObject Object)//Ok { lvItem.SubItems[0].Text = '"' + Object.Name + '"'; lvItem.SubItems[1].Text = Object.X + ", " + Object.Y; lvItem.SubItems[2].Text = '"' + Object.Prototype.Name + '"'; lvItem.SubItems[3].Text = '"' + Object.Reference + '"'; }
private void btnObjectEdit_Click(object sender, EventArgs e)//Ok { if (lvObjects.SelectedItems.Count < 1) { return; } xObject obj = (lvObjects.SelectedItems[0].Tag as xObject); if (obj == null) { return; } // Remove IPs foreach (var IP in obj.IPs) { IP.Map_lvItem.Remove(); IP.Map_lvItem = null; } // Edit new ObjectOptionsForm(obj).ShowDialog(); UpdateObjectNode(lvObjects.SelectedItems[0], obj); // Return IPs in list foreach (var IP in obj.IPs) { Share.lvIPs_Add(lvIPs, IP, ref IP.Map_lvItem); } }
public IPEditForm(xIP ip, xObject owner)//Ok { InitializeComponent(); //Main tpPings.Text = Options.LangCur.lIPTabMain; lblAddress.Text = Options.LangCur.lIPAddress; lblName.Text = Options.LangCur.lEOName; lblPeriod.Text = Options.LangCur.lIPPeriod; lblTimeNext.Text = Options.LangCur.lIPTimeNext; lblTimeOutGreen.Text = Options.LangCur.lIPTimeOutGreen; lblTimeOutYellow.Text = Options.LangCur.lIPTimeOutYellow; lblTimeOutRed.Text = Options.LangCur.lIPTimeOutRed; // Fill if (ip == null) { Text = Options.LangCur.lIPTitleAdd; ip = new xIP(owner); } else { Text = Options.LangCur.lIPTitleEdit; } IP = ip; tbName.Text = IP.Name; tbDescription.Text = IP.Description; tbAddress.Text = IP.Address; // nudTimeOutGreen.Value = IP.TimeOutGreen; nudTimeOutYellow.Value = IP.TimeOutYellow; nudTimeOutRed.Value = IP.TimeOutRed; // dtpDateNext.Value = IP.TimeNext; dtpDateNext.Checked = IP.Onn; nudPeriod.Value = IP.Period; // Pings tpPings.Text = Options.LangCur.lIPTabPings; clmSendTime.Text = Options.LangCur.lIPColumSendTime; clmState.Text = Options.LangCur.lIPColumState; clmTripTime.Text = Options.LangCur.lIPColumTripTime; toolTip.SetToolTip(btnClearPings, Options.LangCur.hIPClearPings); // Fill for (int i = 0; i < IP.PingsCount; i++) { if (IP.Pings[i].State != PingStates.NotSend) { Share.lvPings_Add(lvPings, IP, IP.Pings[i]); } } IP.Pings_lv = lvPings; // Push window sizes tabControl.Width = tlpTimers.Width + 16; }
private void TryToBindToObject(xMap Map, int X, int Y, ref xObject Object, ref UInt64 ObjectID, ref xDot Dot, ref UInt64 DotID, ref int paramX, ref int paramY) { ObjectID = 0; Object = Map.ObjectAt(X, Y) as xObject; if (Object == null) { return; } // Bind ObjectID = Object.ID; Dot = Object.GetNearestDot(X, Y); DotID = Dot.ID; paramX = Object.Left + Dot.X; paramY = Object.Top + Dot.Y; }
private void MainForm_MouseDown(object sender, MouseEventArgs e)// { // Save action start point msXnLast = msXLast = e.X; msYnLast = msYLast = e.Y; Map.SnapXY(ref msXnLast, ref msYnLast); // Prevent senseless action if (rbObject.Checked && rbObject.Tag == null) { rbDefault.Checked = true; } else if (rbLink.Checked && rbLink.Tag == null) { rbDefault.Checked = true; } else if (rbBox.Checked && rbBox.Tag == null) { rbDefault.Checked = true; } #region Default tool if (rbDefault.Checked) { ContextMenuStrip = cmsElement; if (MoverB.Visible && MoverB.X <= msXLast && msXLast < MoverB.X + MoverB.W && MoverB.Y <= msYLast && msYLast < MoverB.Y + MoverB.H) { MoverB.Active = true; } else if (MoverA.Visible && MoverA.X <= msXLast && msXLast < MoverA.X + MoverA.W && MoverA.Y <= msYLast && msYLast < MoverA.Y + MoverA.H) { MoverA.Active = true; } else if (Selection.Visible && Selection.X <= msXLast && msXLast < Selection.X + Selection.W && Selection.Y <= msYLast && msYLast < Selection.Y + Selection.H) { Selection.Active = true; Cursor = Selection.Cursor; } else { if (Map.SelectAt(msXLast + Map.ScrollX, msYLast + Map.ScrollY) == null) { if (hScrollBar.LargeChange < hScrollBar.Maximum) { if (vScrollBar.LargeChange < vScrollBar.Maximum) { Cursor = Cursors.NoMove2D; } else { Cursor = Cursors.NoMoveHoriz; } } else if (vScrollBar.LargeChange < vScrollBar.Maximum) { Cursor = Cursors.NoMoveVert; } else { Cursor = Cursors.No; } ContextMenuStrip = cmsMap; } else { Selection.Active = true; } CheckFrames(true); } } #endregion #region Element tool else { MoverA.Visible = MoverB.Visible = false; ContextMenuStrip = cmsElement; // if (rbObject.Checked) { var Object = new xObject(Map); Object.Prototype = Map.AddPObject(rbObject.Tag as xPrototype); Object.PrototypeID = Object.Prototype.ID; Object.PrototypeRevision = Object.Prototype.Revision; Map.Objects.Add(Object); // Set data Object.X = msXLast + Map.ScrollX; Object.Y = msYLast + Map.ScrollY; Map.SnapXY(ref Object.X, ref Object.Y); // Map.Selected = Object; Selection.Active = true; } else if (rbLink.Checked) { var Link = new xLink(Map); Link.Prototype = Map.AddPLink(rbLink.Tag as xPrototype); Link.PrototypeID = Link.Prototype.ID; Link.PrototypeRevision = Link.Prototype.Revision; Map.Links.Add(Link); // Set data Link.XA = Link.XB = msXLast + Map.ScrollX; Link.YA = Link.YB = msYLast + Map.ScrollY; Map.SnapXY(ref Link.XA, ref Link.YA); Map.SnapXY(ref Link.XB, ref Link.YB); // Try to bind to object Map.Selected = Map.ObjectAt(msXLast + Map.ScrollX, msYLast + Map.ScrollY); if (Map.Selected != null) { Link.ObjectA = Map.Selected as xObject; Link.ObjectAID = Link.ObjectA.ID; Link.DotA = Link.ObjectA.GetNearestDot(msXLast + Map.ScrollX, msYLast + Map.ScrollY); Link.DotAID = Link.DotA.ID; Link.XA = Link.ObjectA.Left + Link.DotA.X; Link.YA = Link.ObjectA.Top + Link.DotA.Y; } // Map.Selected = Link; MoverB.Cursor = Cursors.SizeAll; MoverB.Active = true; } else { var Box = new xBox(Map); Box.Prototype = Map.AddPBox(rbBox.Tag as xPrototype); Box.PrototypeID = Box.Prototype.ID; Box.PrototypeRevision = Box.Prototype.Revision; Map.Boxes.Add(Box); // Set data Box.Left = msXLast + Map.ScrollX; Box.Top = msYLast + Map.ScrollY; Box.Width = 1; Box.Height = 1; Box.Text = (Box.Prototype as xPBox).Text; Map.SnapXY(ref Box.Left, ref Box.Top); // Map.Selected = Box; MoverB.Cursor = Cursors.SizeNWSE; MoverB.Active = true; } // Update Map.Selected.Check(); Map.Draw(Map.Selected.Left - 8, Map.Selected.Top - 8, Map.Selected.Width + 16, Map.Selected.Height + 16); CheckFrames(true); } #endregion Invalidate(); }