public bool IsValid(object caller, Condition condition, Codon codon) { if (WorkbenchSingleton.Workbench != null) { string str = condition.Properties["activewindow"]; if (str == "*") { return (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null); } if ((WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == null) || (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent == null)) { return false; } Type type = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent.GetType(); if (type.FullName == str) { return true; } foreach (Type type2 in type.GetInterfaces()) { if (type2.FullName == str) { return true; } } while ((type = type.BaseType) != null) { if (type.FullName == str) { return true; } } } return false; }
public ToolBarCheckBox(Codon codon, object caller) : base(new CheckBox()) { this.description = string.Empty; this.menuCommand = null; this.RightToLeft = RightToLeft.Inherit; this.caller = caller; this.codon = codon; try { this.menuCommand = (ICheckableMenuCommand) codon.AddIn.CreateObject(codon.Properties["class"]); this.menuCommand.ID = codon.Id; this.menuCommand.Owner = this; this.menuCommand.Codon = codon; } catch (Exception exception) { LoggingService.Error(exception); } if (this.menuCommand == null) { MessageService.ShowError("Can't create toolbar checkbox : " + codon.Id); } this.UpdateText(); this.UpdateStatus(); }
public ToolBarPopupEdit(Codon codon, object caller) : base(new PopupContainerEdit()) { this.menuCommand = null; this.RightToLeft = RightToLeft.Inherit; this.caller = caller; this.codon = codon; this.popupContainerEdit = base.Control as PopupContainerEdit; PopupContainerControl control = new PopupContainerControl(); this.popupContainerEdit.Properties.PopupControl = control; this.popupContainerEdit.Properties.CloseOnLostFocus = false; this.popupContainerEdit.Properties.CloseOnOuterMouseClick = false; control.ControlAdded += new ControlEventHandler(this.popupControl_ControlAdded); this.popupContainerEdit.QueryPopUp += new CancelEventHandler(this.popupContainerEdit_QueryPopUp); this.popupContainerEdit.QueryCloseUp += new CancelEventHandler(this.popupContainerEdit_QueryCloseUp); try { this.CreateCommand(codon); } catch (Exception exception) { LoggingService.Error(exception); } this.UpdateStatus(); this.UpdateText(); }
private ToolBarDateTimeEdit(Codon codon, object caller, DateTimePicker dtEdit) : base(dtEdit) { this.menuCommand = null; this.RightToLeft = RightToLeft.Inherit; this.caller = caller; this.codon = codon; this.dtEdit = dtEdit; if (LoggingService.IsDebugEnabled) { LoggingService.DebugFormatted("时间编辑器的时间是:{0}", new object[] { dtEdit.Value }); } this.dtEdit.Width = Convert.ToInt32(codon.Properties["width"]); try { this.CreateCommand(); } catch (Exception exception) { LoggingService.Error(exception); } if (!this.menuCommand.EditValue.HasValue) { this.dtEdit.Value = DateTime.Now; } else { this.dtEdit.Value = this.menuCommand.EditValue.Value; } this.dtEdit.ValueChanged += new EventHandler(this.EditValueChanged); this.UpdateStatus(); this.UpdateText(); }
public bool IsValid(object caller, Condition condition, Codon codon) { if (caller is IOwnerState) { try { string str = condition.Properties.Get<string>("ownerstate", string.Empty); if (codon.Properties.Contains("ownerstate")) { str = codon.Properties["ownerstate"]; } if (string.IsNullOrEmpty(str) || (str == "*")) { return true; } Enum internalState = ((IOwnerState) caller).InternalState; Enum enum3 = (Enum) Enum.Parse(internalState.GetType(), str); int num = int.Parse(internalState.ToString("D")); int num2 = int.Parse(enum3.ToString("D")); if (LoggingService.IsDebugEnabled) { LoggingService.DebugFormatted("stateInt:{0}, conditionInt:{1}", new object[] { num, num2 }); } return ((num & num2) > 0); } catch (Exception) { throw new ApplicationException(string.Format("[{0}] can't parse '" + condition.Properties["ownerstate"] + "'. Not a valid value.", codon.Id)); } } return false; }
public ToolBarCalcEdit(Codon codon, object caller) : base(new PopupContainerControl()) { this.menuCommand = null; this.RightToLeft = RightToLeft.Inherit; this.caller = caller; this.codon = codon; try { if (codon.Properties.Contains("class")) { this.menuCommand = (ISpinEditCommand) codon.AddIn.CreateObject(codon.Properties["class"]); if (this.menuCommand != null) { this.menuCommand.ID = codon.Id; this.menuCommand.Owner = this; this.menuCommand.Codon = codon; } } } catch (Exception exception) { LoggingService.Error(exception); } this.calcEdit = new CalcEdit(); this.calcEdit.Width = 200; this.calcEdit.EditValue = 1; this.calcEdit.Text = "计算器"; base.Control.Controls.Add(this.calcEdit); this.UpdateStatus(); this.UpdateText(); }
public ToolBarSpinEdit(Codon codon, object caller) : base(new PopupContainerControl()) { this.menuCommand = null; this.RightToLeft = RightToLeft.Inherit; this.caller = caller; this.codon = codon; this.spinEdit = new SpinEdit(); if (!codon.Properties.Contains("width")) { this.spinEdit.Width = 40; } else { this.spinEdit.Width = Convert.ToInt32(codon.Properties["width"]); } this.spinEdit.EditValue = 1; this.spinEdit.EditValueChanged += new EventHandler(this.EditValueChanged); base.Control.Controls.Add(this.spinEdit); try { this.CreateCommand(); } catch (Exception exception) { LoggingService.Error(exception); } this.UpdateStatus(); this.UpdateText(); }
public MenuCommand(string label) { this.menuCommand = null; this.description = ""; this.RightToLeft = RightToLeft.Inherit; this.codon = null; this.caller = null; this.Text = SkyMap.Net.Core.StringParser.Parse(label); }
public SchemeExtensionDescriptor(Codon codon) { this.codon = codon; this.schemeName = codon.Properties["scheme"]; if ((this.schemeName == null) || (this.schemeName.Length == 0)) { this.schemeName = codon.Id; } }
public MenuCheckBox(Codon codon, object caller) { this.description = string.Empty; this.menuCommand = null; this.RightToLeft = RightToLeft.Inherit; this.caller = caller; this.codon = codon; this.UpdateText(); }
public bool IsValid(object caller, Condition condition, Codon codon) { IConditionEvaluator evaluator = (IConditionEvaluator) this.addIn.CreateObject(this.className); if (evaluator == null) { return false; } AddInTree.ConditionEvaluators[this.name] = evaluator; return evaluator.IsValid(caller, condition, codon); }
public ToolBarTextBox(Codon codon, object caller) { this.RightToLeft = RightToLeft.Inherit; base.TextBox.LostFocus += new EventHandler(this.TextBox_LostFocus); this.caller = caller; this.codon = codon; this.CreateCommand(codon); this.UpdateText(); this.UpdateStatus(); }
public object BuildItem(object caller, Codon codon, ArrayList subItems) { IDoozer doozer = (IDoozer) this.addIn.CreateObject(this.className); if (doozer == null) { return null; } AddInTree.Doozers[this.name] = doozer; return doozer.BuildItem(caller, codon, subItems); }
public ToolBarComboBox(Codon codon, object caller) { this.RightToLeft = RightToLeft.Inherit; base.ComboBox.DropDownStyle = ComboBoxStyle.DropDownList; base.ComboBox.SelectedIndexChanged += new EventHandler(this.selectionChanged); base.ComboBox.KeyDown += new KeyEventHandler(this.ComboBoxKeyDown); this.caller = caller; this.codon = codon; if (codon.Properties.Contains("width")) { this.Size = new Size(Convert.ToInt32(codon.Properties["width"]), base.Height); } if (codon.Properties.Contains("dropdownwidth")) { base.DropDownWidth = Convert.ToInt32(codon.Properties["dropdownwidth"]); } if (codon.Properties.Contains("font")) { string str = codon.Properties["font"]; FontConverter converter = new FontConverter(); try { this.Font = (Font) converter.ConvertFrom(str); } catch (Exception exception) { LoggingService.Warn(exception); } } this.CreateCommand(codon); if (base.ComboBox.Items.Count > 0) { if (codon.Properties.Contains("selectindex")) { try { base.ComboBox.SelectedIndex = Convert.ToInt32(codon.Properties["selectindex"]); } catch (Exception exception2) { LoggingService.Warn(exception2); } } else { base.ComboBox.SelectedIndex = 0; } } if (this.menuCommand == null) { throw new NullReferenceException("Can't create combobox menu command"); } this.UpdateText(); this.UpdateStatus(); }
public bool IsValid(object owner, Codon codon) { foreach (ICondition condition in this.conditions) { if (condition.IsValid(owner, codon)) { return true; } } return false; }
public ToolStripItem[] BuildSubmenu(Codon codon, object owner) { MenuCommand[] commandArray = new MenuCommand[ToolLoader.Tool.Count]; for (int i = 0; i < ToolLoader.Tool.Count; i++) { MenuCommand command = new MenuCommand(ToolLoader.Tool[i].ToString(), new EventHandler(this.ToolEvt)); command.Description = "Start tool " + string.Join(string.Empty, ToolLoader.Tool[i].ToString().Split(new char[] { '&' })); commandArray[i] = command; } return commandArray; }
public bool IsValid(object caller, Condition condition, Codon codon) { HtmlViewPane pane = (HtmlViewPane) caller; string input = pane.Url.ToString(); string pattern = condition.Properties["urlRegex"]; string str3 = condition.Properties["options"]; if ((str3 != null) && (str3.Length > 0)) { return Regex.IsMatch(input, pattern, (RegexOptions) Enum.Parse(typeof(RegexOptions), str3, true)); } return Regex.IsMatch(input, pattern); }
public Menu(Codon codon, object caller, ArrayList subItems) { if (subItems == null) { subItems = new ArrayList(); } this.codon = codon; this.caller = caller; this.subItems = subItems; this.RightToLeft = RightToLeft.Inherit; this.UpdateText(); }
public ToolStripItem[] BuildSubmenu(Codon codon, object owner) { List<ToolStripItem> list = new List<ToolStripItem>(); foreach (PadDescriptor descriptor in WorkbenchSingleton.Workbench.PadContentCollection) { if (descriptor.Category == this.Category) { list.Add(new MyMenuItem(descriptor)); } } return list.ToArray(); }
public ToolBarLabel(Codon codon, object caller) { this.RightToLeft = RightToLeft.Inherit; this.caller = caller; this.codon = codon; if ((this.Image == null) && codon.Properties.Contains("icon")) { this.Image = ResourceService.GetBitmap(codon.Properties["icon"]); } this.UpdateStatus(); this.UpdateText(); }
public object BuildItem(object caller, Codon codon, ArrayList subItems) { string input = codon.Properties["label"]; if ((subItems == null) || (subItems.Count == 0)) { if (codon.Properties.Contains("class")) { return new DefaultDialogPanelDescriptor(codon.Id, SkyMap.Net.Core.StringParser.Parse(input), codon.AddIn, codon.Properties["class"]); } return new DefaultDialogPanelDescriptor(codon.Id, SkyMap.Net.Core.StringParser.Parse(input)); } return new DefaultDialogPanelDescriptor(codon.Id, SkyMap.Net.Core.StringParser.Parse(input), new List<IDialogPanelDescriptor>((IDialogPanelDescriptor[]) subItems.ToArray(typeof(IDialogPanelDescriptor)))); }
public bool IsValid(object caller, Condition condition, Codon codon) { if (((WorkbenchSingleton.Workbench == null) || (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == null)) || (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent == null)) { return false; } if (!condition.Properties.Contains("activewindowuntitled")) { return WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.IsUntitled; } bool flag = bool.Parse(condition.Properties["activewindowuntitled"]); return (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.IsUntitled == flag); }
public bool IsValid(object caller, Condition condition, Codon codon) { StringComparison invariantCultureIgnoreCase; string str = condition.Properties["comparisonType"]; if (string.IsNullOrEmpty(str)) { invariantCultureIgnoreCase = StringComparison.InvariantCultureIgnoreCase; } else { invariantCultureIgnoreCase = (StringComparison) Enum.Parse(typeof(StringComparison), str); } return string.Equals(SkyMap.Net.Core.StringParser.Parse(condition.Properties["string"]), SkyMap.Net.Core.StringParser.Parse(condition.Properties["equals"]), invariantCultureIgnoreCase); }
public bool IsValid(object caller, Condition condition, Codon codon) { if (!(caller is IWfBox)) { return false; } try { return (caller as IWfBox).IsSelected; } catch (Exception) { return false; } }
public object BuildItem(object caller, Codon codon, ArrayList subItems) { string path = codon.Properties["item"]; string str2 = codon.Properties["path"]; if ((path != null) && (path.Length > 0)) { return AddInTree.BuildItem(path, caller, codon); } if ((str2 != null) && (str2.Length > 0)) { return new IncludeReturnItem(caller, str2); } MessageService.ShowMessage("<Include> requires the attribute 'item' (to include one item) or the attribute 'path' (to include multiple items)"); return null; }
public bool IsValid(object caller, Condition condition, Codon codon) { if (!(caller is WfView)) { return false; } try { return (caller as WfView).DataForm.ExistFailSavedFile(); } catch (Exception) { return false; } }
public bool IsValid(object caller, Condition condition, Codon codon) { if (!(caller is IWfBox)) { return false; } try { DataView dataSource = (DataView) (caller as IWfBox).DataSource; return ((dataSource != null) && (dataSource.Count > 0)); } catch (Exception) { return false; } }
public MenuCommand(Codon codon, object caller, bool createCommand) { this.menuCommand = null; this.description = ""; this.RightToLeft = RightToLeft.Inherit; this.caller = caller; this.codon = codon; if (createCommand) { this.CreateCommand(); } this.UpdateText(); if (codon.Properties.Contains("shortcut")) { base.ShortcutKeys = ParseShortcut(codon.Properties["shortcut"]); } }
public bool IsValid(object caller, Condition condition, Codon codon) { if (((WorkbenchSingleton.Workbench == null) || (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == null)) || (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent == null)) { return false; } WindowState state = condition.Properties.Get<WindowState>("windowstate", WindowState.None); WindowState state2 = condition.Properties.Get<WindowState>("nowindowstate", WindowState.None); bool flag = false; if (state != WindowState.None) { if ((state & WindowState.Dirty) > WindowState.None) { flag |= WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.IsDirty; } if ((state & WindowState.Untitled) > WindowState.None) { flag |= WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.IsUntitled; } if ((state & WindowState.ViewOnly) > WindowState.None) { flag |= WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.IsViewOnly; } } else { flag = true; } if (state2 != WindowState.None) { if ((state2 & WindowState.Dirty) > WindowState.None) { flag &= !WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.IsDirty; } if ((state2 & WindowState.Untitled) > WindowState.None) { flag &= !WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.IsUntitled; } if ((state2 & WindowState.ViewOnly) > WindowState.None) { flag &= !WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.IsViewOnly; } } return flag; }
public object BuildItem(object caller, Codon codon, ArrayList subItems) { string str = codon.Properties.Contains("type") ? codon.Properties["type"] : "Item"; bool createCommand = codon.Properties["loadclasslazy"] == "false"; switch (str) { case "Separator": return new ToolBarSeparator(codon, caller); case "CheckBox": return new ToolBarCheckBox(codon, caller); case "Item": return new ToolBarCommand(codon, caller, createCommand); case "ComboBox": return new ToolBarComboBox(codon, caller); case "DropDownButton": return new ToolBarDropDownButton(codon, caller); case "PopupEdit": return new ToolBarPopupEdit(codon, caller); case "SpinEdit": return new ToolBarSpinEdit(codon, caller); case "TextBox": return new ToolBarTextBox(codon, caller); case "CalcEdit": return new ToolBarCalcEdit(codon, caller); case "Builder": return codon.AddIn.CreateObject(codon.Properties["class"]); case "Label": return new ToolBarLabel(codon, caller); case "DateTime": return new ToolBarDateTimeEdit(codon, caller); } throw new NotSupportedException("unsupported menu item type : " + str); }