public void RemoveHiddenItemControls(MapItem item) { //Create hidden controls list List <IItemControl> forRemove = new List <IItemControl>(); foreach (IItemControl control in item.ControlsOnScreen.Values) { if (control.Destroyed) { forRemove.Add(control); } } //Remove hidden controls and update ControlUnderCursor item member int forRemoveCnt = forRemove.Count; for (int i = 0; i < forRemoveCnt; i++) { IItemControl control = forRemove[i]; item.ControlsOnScreen.Remove(control.UserObject); if (item.ControlUnderCursor != null && item.ControlUnderCursor == control) { item.ControlUnderCursor = null; } control.Dispose(); } }
private void GroupPostPaint(Graphics graphics, IItemControl control) { //Calculate plus/minus button rectangle int buttonPadding = (GroupAreaHeight - GroupPlusMinusSize) / 2; Rectangle buttonRectangle = new Rectangle(control.ClientRectangle.Left + control.ClientRectangle.Width - buttonPadding - GroupPlusMinusSize, control.ClientRectangle.Top + buttonPadding, GroupPlusMinusSize, GroupPlusMinusSize); //Draw button graphics.FillRectangle(_groupPlusMinusFillBrush, buttonRectangle); graphics.DrawRectangle(_groupPlusMinusFramePen, buttonRectangle); //Draw minus mark const int markPadding = 2; int midY = buttonRectangle.Top + buttonRectangle.Height / 2; graphics.DrawLine(_groupPlusMinusMarkPen, buttonRectangle.Left + markPadding, midY, buttonRectangle.Left + buttonRectangle.Width - markPadding, midY); //Draw plus mark ItemGroup group = (ItemGroup)control.UserObject; if (group.Collapsed) { int midX = buttonRectangle.Left + buttonRectangle.Width / 2; graphics.DrawLine(_groupPlusMinusMarkPen, midX, buttonRectangle.Top + markPadding, midX, buttonRectangle.Top + buttonRectangle.Height - markPadding); } }
private void FlowchartItemMouseUp(object sender, MouseEventArgs e) { _mouseDown = false; //If some control was handled mouse if (CheckOnSelectedItemControlUnhandleMouse()) { _itemControlThatHandledMouse = null; } else { if (LinkingArrows.Count > 0) { Parent.Repaint(); } } //If item control under cursor, check on repaint if (!CheckOnRepaintItemControls(e.Location, e.Button)) { //otherwise check on item resize or move if (!ReadOnly && e.Button == MouseButtons.Left) { ItemResizePosition resizePosition = _resizePosition; _resizePosition = GetCurrentResizePosition(e.Location); SetCursorAccordingToResizePosition(_resizePosition); //Fire actual delegate switch (resizePosition) { case ItemResizePosition.Move: { ItemMoved?.Invoke(this); break; } default: { if (_resizePosition <= ItemResizePosition.BottomRight && _resizePosition > ItemResizePosition.None && ItemResized != null) { ItemResized(this); } break; } } } //Call ItemMouseUp delegate ItemMouseUp?.Invoke(this, e); //Call ItemMouseClick delegate ItemMouseClick?.Invoke(this); } }
private void SetItemControlSelected(IItemControl control) { ItemControlType controlType = ItemControlTypes.TypesTable[control.GetType()]; if (controlType == ItemControlType.Button) { foreach (IItemControl c in ControlsOnScreen.Values) { c.Selected = c == control; } } }
private void AddDeleteEvent(IItemControl item) { if (item != null) { UserControl itemControl = item as UserControl; if (itemControl != null) { item.ItemDelete += itemtoAdd_ItemDelete; flpItem.Controls.Add(itemControl); _pointInfo.IsChanged = true; } } }
public RelationshipTree(IItemControl Parent, Type NodeFormatter) : base(Parent.Session) { // Create Relationship Tree this.Tree = new Trees.Relationship(Parent.Session, NodeFormatter); this.Tree.Region = Regions.Center; // Set Toolbar this.Toolbar = ((IToolbarProvider)this.Tree).Toolbar; this.Toolbar.Region = Regions.Top; // Add Children this.Children.Add(this.Toolbar); this.Children.Add(this.Tree); }
private void OnItemControlClick(IItemControl control, MouseButtons mb) { switch (mb) { case MouseButtons.Left: { ItemGroup group = control.UserObject as ItemGroup; if (group != null) { group.Collapsed = !group.Collapsed; } break; } } }
public RelationshipGrid(IItemControl Parent, Model.RelationshipType RelationshipType) : base(Parent.Session) { // Create Search this.Grid = new Grids.Relationship(Parent, RelationshipType); this.Grid.Region = Regions.Center; // Set Toolbar this.Toolbar = ((IToolbarProvider)this.Grid).Toolbar; this.Toolbar.Region = Regions.Top; // Add Children this.Children.Add(this.Toolbar); this.Children.Add(this.Grid); }
private void FillExistedPointInfo() { this.txtName.Text = _pointInfo.Name; this.txtIP.Text = _pointInfo.IP; this.txtPort.Text = _pointInfo.Port; //Fill items if (_pointInfo.Items == null || _pointInfo.Items.Count() == 0)//no item { return; } foreach (var item in _pointInfo.Items) { IItemControl itemCtr = null; if (item.Type == ItemType.App.ToString()) { itemCtr = new AppPanel(); } else if (item.Type == ItemType.Flash.ToString()) { itemCtr = new FlashPanel(); } else if (item.Type == ItemType.Image.ToString()) { itemCtr = new ImagePanel(); } else if (item.Type == ItemType.PPT.ToString()) { itemCtr = new PPTPanel(); } else if (item.Type == ItemType.Video.ToString()) { itemCtr = new VideoPanel(); } else if (item.Type == ItemType.WebPage.ToString()) { itemCtr = new WebPagePanel(); } //load config if (itemCtr != null) { this.flpItem.Controls.Add(itemCtr as UserControl); itemCtr.LoadItem(item); AddDeleteEvent(itemCtr); } } }
public AdminController( IItemDistributionControl itemDistributionControl, IItemCategoryControl itemCategoryControl, IItemControl itemControl, IPropertyControl propertyControl, IClientProfileControl clientProfileControl, IAdminControl adminControl, IOrderControl orderControl) { _itemDistributionControl = itemDistributionControl; _itemControl = itemControl; _itemCategoryControl = itemCategoryControl; _propertyControl = propertyControl; _clientProfileControl = clientProfileControl; _adminControl = adminControl; _orderControl = orderControl; }
public static MouseButtons ControlStateToMouseButton(IItemControl control) { if (control != null) { switch (control.State) { case ItemControlState.ClickedLeft: return(MouseButtons.Left); case ItemControlState.ClickedRight: return(MouseButtons.Right); default: return(MouseButtons.None); } } return(MouseButtons.None); }
public static void SetControlStateAccordingToMouse(IItemControl control, MouseButtons mb) { if (control.State != ItemControlState.Disabled) { switch (mb) { case MouseButtons.Left: control.State = ItemControlState.ClickedLeft; break; case MouseButtons.Right: control.State = ItemControlState.ClickedRight; break; case MouseButtons.None: control.State = ItemControlState.MouseOn; break; } } }
/// <summary> /// Creates and Adds a new Item input structure and instantiates it from i. /// </summary> public void AddItem(SimpleSerializer i) { if (ControlFile == string.Empty) { throw new Exception("No user control name provided."); } IItemControl Item = (IItemControl)Page.LoadControl(Page.Request.ApplicationPath + ControlFile); Item.Number = Count; if (Hidden || (HideFirst && Item.Number == 0)) { Item.Hidden = true; } Item.ShowDelete = (Item.Number != 0); Controls.Add((Control)Item); if (i != null) { Item.Data = i; } }
/// <summary> /// Creates and Adds a new Item input structure and instantiates it from i. /// </summary> public void AddItem(SimpleSerializer i) { if (ControlFile == string.Empty) { throw new Exception("No user control name provided."); } IItemControl Item = (IItemControl)Page.LoadControl(Page.Request.ApplicationPath + ControlFile); Item.Number = Count; if (Hidden || (HideFirst && Item.Number == 0)) { Item.Hidden = true; } //67811A0 - PCI Remediation for Payment systems CH1: Start commented the line which will be enabled to display the delete button when there is more than one line item getting displayed by cognizant on 09/27/2011. //Item.ShowDelete =(Item.Number!=0); //67811A0 - PCI Remediation for Payment systems CH1:END commented the line which will be enabled to display the delete button when there is more than one line item getting displayed by cognizant on 09/27/2011. Controls.Add((Control)Item); if (i != null) { Item.Data = i; } }
private void Confirm() { CheckChange(); UpdateItemsVersion(); _pointInfo.Name = txtName.Text.Trim(); _pointInfo.IP = txtIP.Text.Trim(); _pointInfo.Port = txtPort.Text.Trim(); _pointInfo.SupportedLan = lanSelecter1.SelectedLan; List <Item> items = new List <Item>(); foreach (var iControl in flpItem.Controls) { IItemControl itemControl = iControl as IItemControl; if (itemControl != null) { items.Add(itemControl.GetItem()); } } _pointInfo.Items = items.ToArray(); _hallHelper.LocalCurrentHallInfo = _hallInfo; _hallHelper.UpdateHallInfo(); _pointInfo.IsChanged = false; }
private void AddItem_Click(object sender, EventArgs e) { ItemType itemType = (ItemType)cbType.SelectedIndex; IItemControl itemtoAdd = null; switch (itemType) { case ItemType.Image: itemtoAdd = new ImagePanel(); break; case ItemType.PPT: itemtoAdd = new PPTPanel(); break; case ItemType.App: itemtoAdd = new AppPanel(); break; case ItemType.Flash: itemtoAdd = new FlashPanel(); break; case ItemType.Video: itemtoAdd = new VideoPanel(); break; case ItemType.WebPage: itemtoAdd = new WebPagePanel(); break; default: break; } itemtoAdd.IsChanged = true; AddDeleteEvent(itemtoAdd); }
public Relationship(IItemControl Parent, Model.RelationshipType RelationshipType) : base(Parent.Session) { // Create Page this.Page = new Properties.Integer(this.Session); this.Page.Value = 1; // Create No Pages this.NoPages = new Properties.Integer(this.Session); this.NoPages.Value = 0; // Only create Dialog when needed this.Dialog = null; // Create Selected this.Selected = new Model.ObservableList <Model.Relationship>(); // Create Comands this.Refresh = new RefreshCommand(this); this.NextPage = new NextPageCommand(this); this.PreviousPage = new PreviousPageCommand(this); this.Create = new CreateCommand(this); this.Delete = new DeleteCommand(this); // Store Parent this.Parent = Parent; // Watch Parent Events this.Parent.Created += Parent_Created; this.Parent.Edited += Parent_Edited; this.Parent.Undone += Parent_Undone; this.Parent.Saved += Parent_Saved; // Store RelationshipType this.RelationshipType = RelationshipType; // Create Grid this.Grid = new Grid(this.Session); this.Grid.AllowSelect = true; this.Grid.Width = this.Width; this.Grid.RowsSelected += Grid_RowsSelected; this.Children.Add(this.Grid); // Create Query String this.QueryString = new Properties.String(this.Session); this.QueryString.Enabled = true; this.QueryString.IntermediateChanges = true; this.QueryString.Tooltip = "Search String"; this.QueryString.PropertyChanged += QueryString_PropertyChanged; // Create Page Size this.PageSize = new Properties.Integers.Spinner(this.Session); this.PageSize.Tooltip = "Page Size"; this.PageSize.Width = 40; this.PageSize.Enabled = true; this.PageSize.MinValue = 5; this.PageSize.MaxValue = 100; this.PageSize.Value = 25; this.PageSize.PropertyChanged += PageSize_PropertyChanged; // Load Columns this.LoadColumns(); }
private bool CheckOnSelectedItemControlHandleMouse(Point pos) { if (ControlUnderCursor != null) { //Get current control type ItemControlType controlType = ItemControlTypes.TypesTable[ControlUnderCursor.GetType()]; //Store current item control that handled mouse _itemControlThatHandledMouse = ControlUnderCursor; switch (controlType) { //LinkPoint case ItemControlType.LinkPoint: { if (ReadOnly) { return(true); } //For right-side link point if (ControlUnderCursor == RightLinkPoint) { //Add new linking arrow Parent.CreateLinkingArrow(this); //Set selected state for the current link point and repaint self _itemControlThatHandledMouse.Selected = true; Repaint(); } //For left-side link point else { LinkingArrow arrow = GetLeftSideLinkedArrow(); if (arrow != null) { Parent.UnlinkArrrow(arrow, this, true); Parent.CurrentLinkingArrow = arrow; _itemControlThatHandledMouse.Selected = GetLeftSideLinkedArrow() != null; } else { _itemControlThatHandledMouse = null; } } break; } //Image case ItemControlType.Image: { return(false); } } //Case mouse movement CheckOnSelectedItemControlMouseMove(pos); //Mouse handled return(true); } //No control under cursor return(false); }
private bool CheckOnRepaintItemControls(Point pos, MouseButtons mb) { //If mouse inside workplace rectangle, get item control under cursor IItemControl control = GetItemControlUnderCursor(pos); if (!WorkplaceRectangle.Contains(pos) && !(control is ItemLinkPoint)) { control = null; } //If control under cursor it`s not same as previous control under cursor //or control state was changed, process changes if (control != ControlUnderCursor || (control != null && (ItemControlHelper.ControlStateToMouseButton(control) != mb))) { //Control state was changed if (control != null && control == ControlUnderCursor) { ItemControlState controlState = control.State; ItemControlHelper.SetControlStateAccordingToMouse(control, mb); //Check on mouse down if (control.State == ItemControlState.ClickedLeft || control.State == ItemControlState.ClickedRight) { //Update current item control selection SetItemControlSelected(control); //Call ItemControlMouseDown delegate ItemControlMouseDown?.Invoke(this, (IItemElement)control.UserObject, new MouseEventArgs(mb, 1, pos.X, pos.Y, 0)); } //Check on mouse click else if ((controlState == ItemControlState.ClickedLeft || controlState == ItemControlState.ClickedRight) && control.State == ItemControlState.MouseOn) { //Get popped mouse button mb = controlState == ItemControlState.ClickedLeft ? MouseButtons.Left : MouseButtons.Right; //Call ItemControlMouseUp delegate ItemControlMouseUp?.Invoke(this, control.UserObject as IItemElement, new MouseEventArgs(mb, 1, pos.X, pos.Y, 0)); //Internal ItemControlClick OnItemControlClick(control, mb); //Call ItemControlMouseClick delegate ItemControlMouseClick?.Invoke(this, (IItemElement)control.UserObject); } } else { //If control under cursor it`s not same as previous control under cursor if (ControlUnderCursor != null && ControlUnderCursor.State != ItemControlState.Disabled) { ControlUnderCursor.State = ItemControlState.Normal; } if (control != null) { control.State = ItemControlState.MouseOn; } } //Set current item control as Control under cursor ControlUnderCursor = control; //Repaint item Repaint(); //Drop resize position _resizePosition = ItemResizePosition.None; SetCursorAccordingToResizePosition(_resizePosition); //Done return(true); } //No changes return(false); }