private void btnAnull_MouseUp(object sender, EventArgs e) { toolIcon_Mini _toolicon = (toolIcon_Mini)sender; _toolicon.Focus(); if (btnAnull_Click != null) { btnAnull_Click(this); } }
public void btnEdit_MouseUp(object sender, EventArgs e) { if (sender != null) { toolIcon_Mini _toolicon = (toolIcon_Mini)sender; _toolicon.Focus(); } if (btnEdit_Click != null) { btnEdit_Click(sender); } }
private void get_Icons(string mod_name, ref entity.Brillo.Security security) { toolBarData t = new toolBarData(); foreach (DataRow row in t.dtIconList_property.Select("modIcon = '" + mod_name + "'")) { toolIcon_Mini ico = new toolIcon_Mini(); string _toolTip = row["tooltip"].ToString(); var appLocTextExtension = new LocTextExtension("COGNITIVO:local:" + _toolTip + "").SetBinding(ico, toolIcon_Mini.icoNameProperty); ico.imgSource = row["img"].ToString(); ico.Cursor = Cursors.Hand; ico.btnColor = Brushes.AliceBlue; ico.iColor = Brushes.RoyalBlue; ico = check_Icons(ico, _toolTip, ref security); if (ico != null && row["placement"].ToString() == "m") { if (_toolTip == "Delete") { ico.btnColor = Brushes.Silver; ico.iColor = Brushes.Black; System.Windows.Shapes.Rectangle rect; rect = new System.Windows.Shapes.Rectangle(); rect.Fill = new SolidColorBrush(Colors.Gainsboro); rect.Width = 0.5; rect.Margin = new Thickness(4); stackMain.Children.Add(rect); stackMain.Children.Add(ico); } else { stackMain.Children.Add(ico); } } else if (ico != null && row["placement"].ToString() == "s") { //Then Secondary Stack if (_toolTip == "Annul") { ico.btnColor = Brushes.Pink; ico.iColor = Brushes.Crimson; } else if (_toolTip == "Approve") { ico.btnColor = Brushes.PaleGreen; ico.iColor = Brushes.Green; } stackSide.Children.Add(ico); } } }
private toolIcon_Mini check_Icons(toolIcon_Mini toolIcon_Mini, string iconName, ref entity.Brillo.Security security) { //Check if Icon should be shown, bind, and rout events. if (btnNew_Click != null & iconName == "New" && security.create) { toolIcon_Mini.Click += btnNew_MouseUp; } else if (btnDelete_Click != null & iconName == "Delete" && security.delete) { toolIcon_Mini.Click += btnDelete_MouseUp; toolIcon_Mini = bind_toolIcon(toolIcon_Mini, "Delete_IsEnabled", false); } else if (btnEdit_Click != null & iconName == "Edit" && security.edit) { toolIcon_Mini.Click += btnEdit_MouseUp; toolIcon_Mini = bind_toolIcon(toolIcon_Mini, "Edit_IsEnabled", false); } else if (btnSave_Click != null & iconName == "Save") { toolIcon_Mini.Click += btnSave_MouseUp; toolIcon_Mini = bind_toolIcon(toolIcon_Mini, "Save_IsEnabled", false); } else if (btnCancel_Click != null & iconName == "Cancel") { toolIcon_Mini.Click += btnCancel_MouseUp; toolIcon_Mini = bind_toolIcon(toolIcon_Mini, "IsEditable", false); } else if (btnApprove_Click != null & iconName == "Approve" && security.approve) { toolIcon_Mini.Click += btnApprove_MouseUp; toolIcon_Mini.iColor = Brushes.PaleGreen; toolIcon_Mini = bind_toolIcon(toolIcon_Mini, "Approve_IsEnabled", false); } else if (btnAnull_Click != null & iconName == "Annul" && security.annul) { toolIcon_Mini.Click += btnAnull_MouseUp; toolIcon_Mini.iColor = Brushes.Crimson; toolIcon_Mini = bind_toolIcon(toolIcon_Mini, "Annul_IsEnabled", false); } else if (btnParent_Click != null & iconName == "Parent") { toolIcon_Mini.Click += btnParent_MouseUp; } else { //toolIcon_Mini.Foreground = Brushes.Gainsboro; return(null); } return(toolIcon_Mini); }
private toolIcon_Mini bind_toolIcon(toolIcon_Mini toolIcon_Mini, string property, bool do_opposite) { Binding Binding = new Binding(); Binding.Source = this; Binding.Path = new PropertyPath(property); Binding.Mode = BindingMode.TwoWay; if (do_opposite) { Cognitivo.Converters.TrueToFalseConverter True2False = new Cognitivo.Converters.TrueToFalseConverter(); Binding.Converter = True2False; } Binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; toolIcon_Mini.SetBinding(IsEnabledProperty, Binding); return(toolIcon_Mini); }