private bool FiltersAreValid() { #if DEBUG Debug.Assert( !Debug_DuplicateFiltersExist(_filterList.TvList.Nodes), "UI failed to prevent duplicate filters from being created." ); #endif ArrayList filtersInErrorList = new ArrayList(); foreach (DeviceFilterTreeNode filterNode in _filterList.TvList.Nodes) { DeviceFilterNode filter = filterNode.DeviceFilter; if (!FilterIsLegal(filter)) { filtersInErrorList.Add(filter.Name); } } if (filtersInErrorList.Count != 0) { GenericUI.ShowWarningMessage( SR.GetString(SR.DeviceFilterEditorDialog_Title), SR.GetString( SR.DeviceFilterEditorDialog_InvalidFilter, GenericUI.BuildCommaDelimitedList( filtersInErrorList ) ) ); return(false); } return(true); }
void SetEditor(bool reset = false) { if (reset || OpenContext != FSelectedSignal.PluginContext) { ClearCurrentView(); OpenContext = FSelectedSignal.PluginContext; if (HasEditor(OpenContext)) { OpenContext.PluginCommandStub.EditorOpen(PluginPanel.Handle); FHasEditor = true; if (FGenericUI != null) { PluginPanel.Controls.Remove(FGenericUI); FGenericUI.Dispose(); FGenericUI = null; } } else { FGenericUI = new GenericUI(OpenContext); FGenericUI.Dock = DockStyle.Fill; PluginPanel.Controls.Add(FGenericUI); FHasEditor = false; } } }
private void OnRemove(Object sender, EventArgs e) { ChoiceTreeNode choice = (ChoiceTreeNode)_appliedFiltersList.TvList.SelectedNode; if (ChoiceHasContent(choice.RuntimeChoice)) { if (!GenericUI.ConfirmYesNo( SR.GetString(SR.AppliedDeviceFiltersDialog_Title), SR.GetString( SR.AppliedDeviceFiltersDialog_AssociatedItemsWillBeLost ) )) { return; } } _appliedFiltersList.TvList.Nodes.Remove(_appliedFiltersList.TvList.SelectedNode); // If it was the default filter, and it a duplicate is not still // still applied (error in HTML view), return it to the list of // available filters. if (IsDefaultFilter(choice.Name)) { EnsureDefaultFilterAvailableXorApplied(); } _appliedFiltersList.UpdateButtonsEnabling(); SetDirty(true); UpdateUI(); }
private void ChangeWindowLayout(object sender, GenericControls.WindowLayoutEventArgs e) { switch (e.ArgWindowLayout) { case Utils.UserTypes.DOCTOR: mainUI = new DoctorUI(); break; case Utils.UserTypes.ADMIN: mainUI = new AdminUI(); break; case Utils.UserTypes.PATIENT: mainUI = new PatientUI(); break; default: mainUI = new MainUI(); break; } mainUI.OnMainWindowLayoutChange += new GenericUI.ChangeMainWindowLayoutHandler(ChangeWindowLayout); mainUI.VerticalAlignment = VerticalAlignment.Stretch; pageContainer.Children.RemoveAt(0); pageContainer.Children.Add(mainUI); }
// NOTE: AppliedDeviceFiltersDialog also uses this test... internal static bool NewLabelIsLegal( ISite site, EditableTreeList filterList, String oldLabel, String newLabel, String errorDialogTitle ) { Debug.Assert(site != null); if (newLabel.Length == 0) { GenericUI.ShowWarningMessage( errorDialogTitle, SR.GetString(SR.DeviceFilterEditorDialog_UnnamedFilter) ); return(false); } /* Removed for DCR 4240 * if (!DesignerUtility.IsValidName(newLabel)) * { * GenericUI.ShowWarningMessage( * errorDialogTitle, * SR.GetString(SR.DeviceFilterEditorDialog_IllegalName, newLabel) * ); * return false; * } */ return(true); }
private void ApplyChoiceToRuntimeControl_helper( PropertyDescriptor property, Object target, String prefix ) { String propertyName = prefix + property.Name; String value = ((IAttributeAccessor)_choice).GetAttribute(propertyName) as String; if (property.Converter is ExpandableObjectConverter) { PropertyDescriptorCollection properties = TypeDescriptor.GetProperties( property.PropertyType ); foreach (PropertyDescriptor embeddedProperty in properties) { if (IsDeviceOverridable(embeddedProperty)) { ApplyChoiceToRuntimeControl_helper( embeddedProperty, property.GetValue(target), propertyName + "-" ); } } return; } if (value != null) { try { property.SetValue( target, property.Converter.ConvertFromString(value) ); } catch { GenericUI.ShowWarningMessage( SR.GetString(SR.PropertyOverridesDialog_Title), SR.GetString( SR.PropertyOverridesDialog_InvalidPropertyValue, value, propertyName ) ); } } }
private bool ValidateAppliedFilters() { StringCollection duplicateChoices = DesignerUtility.GetDuplicateChoiceTreeNodes( _appliedFiltersList.TvList.Nodes ); if (duplicateChoices.Count > 0) { GenericUI.ShowWarningMessage( SR.GetString(SR.AppliedDeviceFiltersDialog_Title), SR.GetString(SR.AppliedDeviceFiltersDialog_DuplicateChoices, GenericUI.BuildCommaDelimitedList(duplicateChoices)) ); return(false); } return(true); }
/// <summary> /// Create a new StylesEditorDialog instance /// </summary> /// <internalonly/> internal StylesEditorDialog(StyleSheet stylesheet, StyleSheetDesigner styleSheetDesigner, String initialStyleName) { if (stylesheet.DuplicateStyles.Count > 0) { GenericUI.ShowErrorMessage( SR.GetString(SR.StylesEditorDialog_Title), SR.GetString(SR.StylesEditorDialog_DuplicateStyleNames) ); throw new ArgumentException( SR.GetString(SR.StylesEditorDialog_DuplicateStyleException) ); } _tempStyleSheet = new StyleSheet(); _previewStyle = new Style(); _styleSheet = stylesheet; _styleSheetDesigner = styleSheetDesigner; _tempStyleSheet.Site = _styleSheet.Site; InitializeComponent(); InitAvailableStyles(); LoadStyleItems(); if (_tvDefinedStyles.Nodes.Count > 0) { int initialIndex = 0; if (initialStyleName != null) { initialIndex = StyleIndex(initialStyleName); } SelectedStyle = (StyleNode)_tvDefinedStyles.Nodes[initialIndex]; _tvDefinedStyles.Enabled = true; UpdateTypeText(); UpdatePropertyGrid(); } UpdateButtonsEnabling(); UpdateFieldsEnabling(); }
private bool SaveFilters() { Cursor oldCursor = null; try { oldCursor = this.Cursor; this.Cursor = Cursors.WaitCursor; ArrayList oldFilters = _webConfig.ReadDeviceFilters(); foreach (DeviceFilterNode filter in oldFilters) { filter.Delete(); } _webConfig.EnsureSystemWebSectionIsPresent(); foreach (DeviceFilterTreeNode filter in _filterList.TvList.Nodes) { filter.DeviceFilter.Save(); } _webConfig.Save(); } catch (FileNotFoundException) { this.Cursor = oldCursor; GenericUI.ShowWarningMessage( SR.GetString(SR.DeviceFilterEditorDialog_Title), SR.GetString(SR.DeviceFilterEditorDialog_WebConfigMissing) ); return(false); } catch (Exception e) { this.Cursor = oldCursor; GenericUI.ShowWarningMessage( SR.GetString(SR.DeviceFilterEditorDialog_Title), SR.GetString(SR.DeviceFilterEditorDialog_WebConfigParsingError, e.Message) ); Debug.Fail(e.ToString()); return(false); } this.Cursor = oldCursor; return(true); }
private void OnAfterLabelEdit(Object sender, NodeLabelEditEventArgs e) { // null still returned if label unmodified (verified 2310) if (e.Label == null) { return; } String oldLabel = e.Node.Text; String newLabel = e.Label; bool labelIsLegal = true; if (!DeviceFilterEditorDialog.NewLabelIsLegal( _designer.UnderlyingControl.Site, _appliedFiltersList, oldLabel, newLabel, SR.GetString(SR.AppliedDeviceFiltersDialog_Title) )) { labelIsLegal = false; } else if (IsDefaultFilter(newLabel)) { GenericUI.ShowWarningMessage( SR.GetString(SR.AppliedDeviceFiltersDialog_Title), SR.GetString(SR.DeviceFilterEditorDialog_IllegalDefaultName) ); labelIsLegal = false; } if (!labelIsLegal) { e.CancelEdit = true; return; } ((ChoiceTreeNode)e.Node).Name = newLabel; EnsureDefaultFilterAvailableXorApplied(); SetDirty(true); UpdateUI(); }
internal TemplatingOptionsDialog(MobileTemplatedControlDesigner designer, ISite site, int mergingContext) { _strCollSchemas = new StringCollection(); _mergingContext = mergingContext; _designer = designer; _site = site; _dsd = (IDeviceSpecificDesigner)designer; _dsd.SetDeviceSpecificEditor(this); InitializeComponent(); this.Text = SR.GetString(SR.TemplatingOptionsDialog_Title); _btnHelp.Text = SR.GetString(SR.GenericDialog_HelpBtnCaption); _btnClose.Text = SR.GetString(SR.GenericDialog_CloseBtnCaption); _lblSchemas.Text = SR.GetString(SR.TemplatingOptionsDialog_SchemaCaption); _btnEditChoices.Text = SR.GetString(SR.TemplatingOptionsDialog_EditBtnCaption); _lblChoices.Text = SR.GetString(SR.TemplatingOptionsDialog_FilterCaption); _schemasFriendly = new String[] { SR.GetString(SR.TemplatingOptionsDialog_HTMLSchemaFriendly), SR.GetString(SR.TemplatingOptionsDialog_CHTMLSchemaFriendly) }; _schemasUrl = new String[] { SR.GetString(SR.MarkupSchema_HTML32), SR.GetString(SR.MarkupSchema_cHTML10) }; int tabOffset = GenericUI.InitDialog( this, _dsd, _mergingContext ); SetTabIndexes(tabOffset); _dsd.RefreshHeader(_mergingContext); String currentDeviceSpecificID = _dsd.CurrentDeviceSpecificID; if (null != currentDeviceSpecificID && currentDeviceSpecificID.Length > 0) { DeviceSpecific ds; _dsd.GetDeviceSpecific(currentDeviceSpecificID, out ds); ((IRefreshableDeviceSpecificEditor)this).Refresh(currentDeviceSpecificID, ds); } UpdateControlEnabling(); }
static void Main(string[] args) { var service = GetProvider(); var opcao = ""; while (opcao != "X") { opcao = GenericUI.ShowTelaInicial(); switch (opcao) { case "1": service.GetService <PessoaUI>().Show(); break; case "2": service.GetService <GrupoPessoaUI>().Show(); break; } } }
private bool ValidateLoadedChoices() { StringCollection duplicateChoices = DesignerUtility.GetDuplicateChoiceTreeNodes( _cbChoices.Items ); if (duplicateChoices.Count > 0) { if (!_ignoreSelectionChanged) { GenericUI.ShowWarningMessage( SR.GetString(SR.PropertyOverridesDialog_Title), SR.GetString(SR.PropertyOverridesDialog_DuplicateChoices, GenericUI.BuildCommaDelimitedList(duplicateChoices)) ); } return(false); } return(true); }
private void OnAfterLabelEdit(Object sender, NodeLabelEditEventArgs e) { // null still returned if label unmodified (verified 2310) if (e.Label == null) { return; } String oldLabel = e.Node.Text; String newLabel = e.Label; if (String.Compare(oldLabel, newLabel, StringComparison.OrdinalIgnoreCase) != 0 && _filterList.LabelExists(newLabel)) { // if the filter is duplicate GenericUI.ShowWarningMessage( SR.GetString(SR.DeviceFilterEditorDialog_Title), SR.GetString(SR.DeviceFilterEditorDialog_DuplicateName, newLabel) ); } else if (String.Compare(newLabel, _nameOfDefaultFilter, StringComparison.OrdinalIgnoreCase) == 0) { GenericUI.ShowWarningMessage( SR.GetString(SR.DeviceFilterEditorDialog_Title), SR.GetString(SR.DeviceFilterEditorDialog_IllegalDefaultName, newLabel) ); } else if (NewLabelIsLegal(_site, _filterList, oldLabel, newLabel, SR.GetString(SR.DeviceFilterEditorDialog_Title) )) { // if the filter name is legal ((DeviceFilterTreeNode)e.Node).DeviceFilter.Name = e.Label; return; } // if the filter name was duplicate or not legal e.CancelEdit = true; }
public MainWindow() { InitializeComponent(); try { DBConnection.CreateConnection("localhost", "orcl", "hr", "hr"); } catch (Exception) { try { DBConnection.CreateConnection("localhost", "ORCL", "hr", "roxana"); } catch (Exception ex) { MessageBox.Show(ex.Message); Environment.Exit(1); } } mainUI = new MainUI(); mainUI.OnMainWindowLayoutChange += new GenericUI.ChangeMainWindowLayoutHandler(ChangeWindowLayout); mainUI.VerticalAlignment = VerticalAlignment.Stretch; pageContainer.Children.Add(mainUI); }
protected override String GetDesignTimeNormalHtml() { String curStyle, message; ArrayList lstStylesInCycle = null; if (null == CurrentStyle) { curStyle = SR.GetString(SR.StyleSheet_PropNotSet); } else { curStyle = HttpUtility.HtmlEncode(CurrentStyle.Name); } String curChoice; if (null == CurrentChoice) { curChoice = SR.GetString(SR.StyleSheet_PropNotSet); } else { if (CurrentChoice.Filter.Length == 0) { curChoice = SR.GetString(SR.DeviceFilter_DefaultChoice); } else { curChoice = HttpUtility.HtmlEncode(DesignerUtility.ChoiceToUniqueIdentifier(CurrentChoice)); } } message = SR.GetString(SR.StyleSheet_DefaultMessage); bool renderErrorMsg = false; String errorMsg = null; String errorIconUrl = null; if (_isDuplicate) { renderErrorMsg = true; errorMsg = SR.GetString(SR.StyleSheet_DuplicateWarningMessage); errorIconUrl = MobileControlDesigner.errorIcon; } else if (_styleSheet.DuplicateStyles.Count > 0) { renderErrorMsg = true; errorMsg = SR.GetString( SR.StyleSheet_DuplicateStyleNamesMessage, GenericUI.BuildCommaDelimitedList( GetDuplicateStyleNames() ) ); errorIconUrl = MobileControlDesigner.errorIcon; } else if (null != CurrentStyle && null != CurrentChoice) { if (IsHTMLSchema(CurrentChoice)) { message = SR.GetString(SR.StyleSheet_TemplateEditingMessage); } else { // User has selected non-html schema renderErrorMsg = true; errorMsg = SR.GetString(SR.MobileControl_NonHtmlSchemaErrorMessage); errorIconUrl = MobileControlDesigner.infoIcon; } } if (renderErrorMsg) { Debug.Assert(errorMsg != null && errorIconUrl != null); return(String.Format(CultureInfo.CurrentCulture, _specialCaseDesignTimeHTML, new Object[] { _styleSheet.Site.Name, curStyle, curChoice, message, errorIconUrl, errorMsg })); } else { lstStylesInCycle = DetectCycles(); // if (lstStylesInCycle != null && lstStylesInCycle.Count > 0) { String cycledStyles = String.Empty; // foreach (Object obj in lstStylesInCycle) { Style cycledStyle = (Style)obj; if (cycledStyles.Length > 0) { cycledStyles += ", "; } cycledStyles += cycledStyle.Name; } return(String.Format(CultureInfo.CurrentCulture, _specialCaseDesignTimeHTML, new Object[] { _styleSheet.Site.Name, curStyle, curChoice, message, MobileControlDesigner.errorIcon, SR.GetString(SR.StyleSheet_RefCycleErrorMessage, cycledStyles) })); } else { return(String.Format(CultureInfo.CurrentCulture, _designTimeHTML, new Object[] { _styleSheet.Site.Name, curStyle, curChoice, message })); } } }
private void InitializeComponent() { _btnOK = new Button(); _btnCancel = new Button(); _btnHelp = new Button(); _btnUp = new Button(); _btnDown = new Button(); _btnAdd = new Button(); _btnRemove = new Button(); _txtType = new TextBox(); _tvDefinedStyles = new TreeView(); _lvAvailableStyles = new ListView(); _samplePreview = new MSHTMLHost(); _propertyBrowser = new PropertyGrid(); _cntxtMenuItem = new MenuItem(); _cntxtMenu = new ContextMenu(); GroupLabel grplblStyleList = new GroupLabel(); grplblStyleList.SetBounds(6, 5, 432, 16); grplblStyleList.Text = SR.GetString(SR.StylesEditorDialog_StyleListGroupLabel); grplblStyleList.TabStop = false; grplblStyleList.TabIndex = 0; Label lblAvailableStyles = new Label(); lblAvailableStyles.SetBounds(14, 25, 180, 16); lblAvailableStyles.Text = SR.GetString(SR.StylesEditorDialog_AvailableStylesCaption); lblAvailableStyles.TabStop = false; lblAvailableStyles.TabIndex = 1; ColumnHeader chStyleType = new System.Windows.Forms.ColumnHeader(); ColumnHeader chStyleNamespace = new System.Windows.Forms.ColumnHeader(); chStyleType.Width = 16; chStyleType.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; chStyleNamespace.Width = 16; chStyleNamespace.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; _lvAvailableStyles.SetBounds(14, 41, 180, 95); _lvAvailableStyles.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; _lvAvailableStyles.MultiSelect = false; _lvAvailableStyles.HideSelection = false; _lvAvailableStyles.FullRowSelect = true; _lvAvailableStyles.View = System.Windows.Forms.View.Details; _lvAvailableStyles.Columns.AddRange(new System.Windows.Forms.ColumnHeader[2] { chStyleType, chStyleNamespace }); _lvAvailableStyles.SelectedIndexChanged += new EventHandler(this.OnNewStyleTypeChanged); _lvAvailableStyles.DoubleClick += new EventHandler(this.OnDoubleClick); _lvAvailableStyles.Sorting = SortOrder.Ascending; _lvAvailableStyles.TabIndex = 2; _lvAvailableStyles.TabStop = true; _btnAdd.SetBounds(198, 77, 32, 25); _btnAdd.Text = SR.GetString(SR.StylesEditorDialog_AddBtnCation); _btnAdd.Click += new EventHandler(this.OnClickAddButton); _btnAdd.TabIndex = 3; _btnAdd.TabStop = true; Label lblDefinedStyles = new Label(); lblDefinedStyles.SetBounds(234, 25, 166, 16); lblDefinedStyles.Text = SR.GetString(SR.StylesEditorDialog_DefinedStylesCaption); lblDefinedStyles.TabStop = false; lblDefinedStyles.TabIndex = 4;; _tvDefinedStyles.SetBounds(234, 41, 166, 95); _tvDefinedStyles.AfterSelect += new TreeViewEventHandler(OnStylesSelected); _tvDefinedStyles.AfterLabelEdit += new NodeLabelEditEventHandler(OnAfterLabelEdit); _tvDefinedStyles.LabelEdit = true; _tvDefinedStyles.ShowPlusMinus = false; _tvDefinedStyles.HideSelection = false; _tvDefinedStyles.Indent = 15; _tvDefinedStyles.ShowRootLines = false; _tvDefinedStyles.ShowLines = false; _tvDefinedStyles.ContextMenu = _cntxtMenu; _tvDefinedStyles.TabIndex = 5; _tvDefinedStyles.TabStop = true; _tvDefinedStyles.KeyDown += new KeyEventHandler(OnKeyDown); _tvDefinedStyles.MouseUp += new MouseEventHandler(OnListMouseUp); _tvDefinedStyles.MouseDown += new MouseEventHandler(OnListMouseDown); _btnUp.SetBounds(404, 41, 28, 27); _btnUp.Click += new EventHandler(this.OnClickUpButton); _btnUp.Image = GenericUI.SortUpIcon; _btnUp.TabIndex = 6; _btnUp.TabStop = true; _btnDown.SetBounds(404, 72, 28, 27); _btnDown.Click += new EventHandler(this.OnClickDownButton); _btnDown.Image = GenericUI.SortDownIcon; _btnDown.TabIndex = 7; _btnDown.TabStop = true; _btnRemove.SetBounds(404, 109, 28, 27); _btnRemove.Click += new EventHandler(this.OnClickRemoveButton); _btnRemove.Image = GenericUI.DeleteIcon; _btnRemove.TabIndex = 8; _btnRemove.TabStop = true; GroupLabel grplblStyleProperties = new GroupLabel(); grplblStyleProperties.SetBounds(6, 145, 432, 16); grplblStyleProperties.Text = SR.GetString(SR.StylesEditorDialog_StylePropertiesGroupLabel); grplblStyleProperties.TabStop = false; grplblStyleProperties.TabIndex = 9; Label lblType = new Label(); lblType.SetBounds(14, 165, 180, 16); lblType.Text = SR.GetString(SR.StylesEditorDialog_TypeCaption); lblType.TabIndex = 10; lblType.TabStop = false; _txtType.SetBounds(14, 181, 180, 16); _txtType.ReadOnly = true; _txtType.TabIndex = 11; _txtType.TabStop = true; Label lblSample = new Label(); lblSample.SetBounds(14, 213, 180, 16); lblSample.Text = SR.GetString(SR.StylesEditorDialog_SampleCaption); lblSample.TabStop = false; lblSample.TabIndex = 12; _samplePreview.SetBounds(14, 229, 180, 76); _samplePreview.TabStop = false; _samplePreview.TabIndex = 13; Label lblProperties = new Label(); lblProperties.SetBounds(234, 165, 198, 16); lblProperties.Text = SR.GetString(SR.StylesEditorDialog_PropertiesCaption); lblProperties.TabIndex = 14; lblProperties.TabStop = false; _propertyBrowser.SetBounds(234, 181, 198, 178); _propertyBrowser.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right; _propertyBrowser.ToolbarVisible = false; _propertyBrowser.HelpVisible = false; _propertyBrowser.TabIndex = 15; _propertyBrowser.TabStop = true; _propertyBrowser.PropertySort = PropertySort.Alphabetical; _propertyBrowser.PropertyValueChanged += new PropertyValueChangedEventHandler(this.OnPropertyValueChanged); _btnOK.DialogResult = DialogResult.OK; _btnOK.Location = new System.Drawing.Point(201, 370); _btnOK.Size = new System.Drawing.Size(75, 23); _btnOK.TabIndex = 16; _btnOK.Text = SR.GetString(SR.GenericDialog_OKBtnCaption); _btnOK.Click += new EventHandler(this.OnClickOKButton); _btnCancel.DialogResult = DialogResult.Cancel; _btnCancel.Location = new System.Drawing.Point(282, 370); _btnCancel.Size = new System.Drawing.Size(75, 23); _btnCancel.TabIndex = 17; _btnCancel.Text = SR.GetString(SR.GenericDialog_CancelBtnCaption); _btnHelp.Click += new EventHandler(this.OnClickHelpButton); _btnHelp.Location = new System.Drawing.Point(363, 370); _btnHelp.Size = new System.Drawing.Size(75, 23); _btnHelp.TabIndex = 18; _btnHelp.Text = SR.GetString(SR.GenericDialog_HelpBtnCaption); _cntxtMenuItem.Text = SR.GetString(SR.EditableTreeList_Rename); _cntxtMenu.MenuItems.Add(_cntxtMenuItem); _cntxtMenu.Popup += new EventHandler(OnPopup); _cntxtMenuItem.Click += new EventHandler(OnContextMenuItemClick); GenericUI.InitDialog(this, _styleSheet.Site); this.Text = _styleSheet.ID + " - " + SR.GetString(SR.StylesEditorDialog_Title); this.ClientSize = new Size(444, 401); this.AcceptButton = _btnOK; this.CancelButton = _btnCancel; this.Activated += new System.EventHandler(StylesEditorDialog_Activated); this.HelpRequested += new HelpEventHandler(this.OnHelpRequested); this.Controls.AddRange(new Control[] { grplblStyleList, lblAvailableStyles, _lvAvailableStyles, _btnAdd, lblDefinedStyles, _tvDefinedStyles, _btnUp, _btnDown, _btnRemove, grplblStyleProperties, lblType, _txtType, lblSample, _samplePreview, lblProperties, _propertyBrowser, _btnOK, _btnCancel, _btnHelp }); }
internal AppliedDeviceFiltersDialog( IDeviceSpecificDesigner designer, int mergingContext) { _designer = designer; _designer.SetDeviceSpecificEditor(this); // Required for Win Form Designer support InitializeComponent(); _lblAvailableFilters.Text = SR.GetString(SR.AppliedDeviceFiltersDialog_AvailableDeviceFilters); _appliedFiltersList.LblTitle.Text = SR.GetString(SR.AppliedDeviceFiltersDialog_AppliedDeviceFilters); _btnEditFilters.Text = SR.GetString(SR.GenericDialog_Edit); _btnApplyFilter.Text = SR.GetString(SR.AppliedDeviceFiltersDialog_ApplyDeviceFilter); _lblArgument.Text = SR.GetString(SR.AppliedDeviceFiltersDialog_Argument); _cmdOK.Text = SR.GetString(SR.GenericDialog_OKBtnCaption); _cmdCancel.Text = SR.GetString(SR.GenericDialog_CancelBtnCaption); _cmdHelp.Text = SR.GetString(SR.GenericDialog_HelpBtnCaption); int tabOffset = GenericUI.InitDialog( this, _designer, mergingContext ); this.Text = _designer.UnderlyingControl.ID + " - " + SR.GetString(SR.AppliedDeviceFiltersDialog_Title); SetTabIndexes(tabOffset); _webConfig = new WebConfigManager(_designer.UnderlyingControl.Site); LoadAvailableFilters(); // Note that the following can cause an // IDeviceSpecificDesigner.Refresh() to occur as a side-effect. _designer.RefreshHeader(mergingContext); _currentDeviceSpecificID = _designer.CurrentDeviceSpecificID; if (_currentDeviceSpecificID != null) { DeviceSpecific ds; _designer.GetDeviceSpecific(_currentDeviceSpecificID, out ds); LoadChoices(ds); } // Register Event Handlers _cbAvailableFilters.SelectedIndexChanged += new EventHandler( OnAvailableFilterSelected ); _cbAvailableFilters.TextChanged += new EventHandler( OnAvailableFilterSelected ); _btnApplyFilter.Click += new EventHandler(OnApplyFilter); _btnEditFilters.Click += new EventHandler(OnEditFilters); _appliedFiltersList.TvList.AfterSelect += new TreeViewEventHandler(OnAppliedFilterSelected); _appliedFiltersList.TvList.AfterLabelEdit += new NodeLabelEditEventHandler(OnAfterLabelEdit); _appliedFiltersList.BtnUp.Click += new EventHandler(OnAppliedFiltersReordered); _appliedFiltersList.BtnDown.Click += new EventHandler(OnAppliedFiltersReordered); _appliedFiltersList.BtnRemove.Click -= _appliedFiltersList.RemoveHandler; _appliedFiltersList.BtnRemove.Click += new EventHandler(OnRemove); _tbArgument.TextChanged += new EventHandler(OnArgumentChanged); _cmdOK.Click += new EventHandler(OnOK); _cmdCancel.Click += new EventHandler(OnCancel); _cmdHelp.Click += new EventHandler(OnHelp); UpdateUI(); }
internal PropertyOverridesDialog( IDeviceSpecificDesigner designer, int mergingContext ) { _designer = designer; _mergingContext = mergingContext; // Required for Win Form Designer support InitializeComponent(); this._lblAppliedFilters.Text = SR.GetString(SR.PropertyOverridesDialog_AppliedDeviceFilters); this._btnEditFilters.Text = SR.GetString(SR.GenericDialog_Edit); this._lblProperties.Text = SR.GetString(SR.PropertyOverridesDialog_DeviceSpecificProperties); this._cmdOK.Text = SR.GetString(SR.GenericDialog_OKBtnCaption); this._cmdCancel.Text = SR.GetString(SR.GenericDialog_CancelBtnCaption); this._cmdHelp.Text = SR.GetString(SR.GenericDialog_HelpBtnCaption); int tabOffset = GenericUI.InitDialog( this, _designer, _mergingContext ); this.Text = _designer.UnderlyingControl.ID + " - " + SR.GetString(SR.PropertyOverridesDialog_Title); SetTabIndexes(tabOffset); _designer.SetDeviceSpecificEditor(this); // Note that the following can cause an // IDeviceSpecificDesigner.Refresh() to occur as a side-effect. _designer.RefreshHeader(_mergingContext); _ignoreSelectionChanged = false; // NOTE: Calling CurrentDeviceSpecificID will cause a refresh to // happen as a side effect. _currentDeviceSpecificID = _designer.CurrentDeviceSpecificID; if (_currentDeviceSpecificID != null) { _cbChoices.Items.Clear(); LoadChoices(_currentDeviceSpecificID); if (!ValidateLoadedChoices()) { // Throw to prevent dialog from opening. Caught and hidden // by PropertyOverridesTypeEditor.cs throw new InvalidChoiceException( "Property overrides dialog can not open because there " + "are invalid choices defined in the page." ); } } // Register Event Handlers _cbChoices.SelectedIndexChanged += new EventHandler( OnFilterSelected ); _btnEditFilters.Click += new EventHandler(OnEditFilters); _cmdOK.Click += new EventHandler(OnOK); _cmdCancel.Click += new EventHandler(OnCancel); _cmdHelp.Click += new EventHandler(OnHelp); UpdateUI(); }
// NOTE: A FileLoadException is thrown if an error occurs while reading // web.config. internal DeviceFilterEditorDialog(ISite site, WebConfigManager webConfig) : base(site) { InitializeComponent(); _lblArgument.Text = SR.GetString(SR.DeviceFilterEditorDialog_Argument); _glAttributes.Text = SR.GetString(SR.DeviceFilterEditorDialog_Attributes); _lblMethod.Text = SR.GetString(SR.DeviceFilterEditorDialog_Method); _glType.Text = SR.GetString(SR.DeviceFilterEditorDialog_TypeGl); _rbCompare.Text = SR.GetString(SR.DeviceFilterEditorDialog_Equality); _lblCompare.Text = SR.GetString(SR.DeviceFilterEditorDialog_Compare); _rbDelegate.Text = SR.GetString(SR.DeviceFilterEditorDialog_Evaluator); _lblType.Text = SR.GetString(SR.DeviceFilterEditorDialog_TypeTxt); _lblHeader.Text = SR.GetString(SR.DeviceFilterEditorDialog_Header); this.Text = SR.GetString(SR.DeviceFilterEditorDialog_Title); int tabOffset = 0; this._pnlMain.TabIndex = tabOffset++; this._filterList.TabIndex = tabOffset++; this._pnlRight.TabIndex = tabOffset++; this._glType.TabIndex = tabOffset++; this._rbCompare.TabIndex = tabOffset++; this._rbDelegate.TabIndex = tabOffset++; this._glAttributes.TabIndex = tabOffset++; this._pnlCompare.TabIndex = tabOffset++; this._pnlDelegate.TabIndex = tabOffset++; this._lblCompare.TabIndex = tabOffset++; this._cbCompare.TabIndex = tabOffset++; this._lblType.TabIndex = tabOffset++; this._txtType.TabIndex = tabOffset++; this._lblArgument.TabIndex = tabOffset++; this._txtArgument.TabIndex = tabOffset++; this._lblMethod.TabIndex = tabOffset++; this._txtMethod.TabIndex = tabOffset++; this._dialogButtons.TabIndex = tabOffset++; _webConfig = webConfig; this._site = site; GenericUI.InitDialog(this, site); _filterList.LblTitle.Text = SR.GetString(SR.DeviceFilterEditorDialog_DeviceFilters); _filterList.BtnAdd.Text = SR.GetString(SR.DeviceFilterEditorDialog_NewDeviceFilter); // Attempt to load Device Filters ArrayList filters = null; try { filters = _webConfig.ReadDeviceFilters(); } catch (FileNotFoundException e) { GenericUI.ShowWarningMessage( SR.GetString(SR.DeviceFilterEditorDialog_Title), SR.GetString(SR.DeviceFilterEditorDialog_WebConfigMissingOnOpen) ); throw new FileLoadException( SR.GetString(SR.WebConfig_FileLoadException, e) ); } catch (Exception e) { if (e.Message.Equals(SR.GetString(SR.DeviceFilterEditorDialog_DuplicateNames))) { GenericUI.ShowWarningMessage( SR.GetString(SR.DeviceFilterEditorDialog_Title), SR.GetString(SR.DeviceFilterEditorDialog_DuplicateNames) ); } else { GenericUI.ShowWarningMessage( SR.GetString(SR.DeviceFilterEditorDialog_Title), SR.GetString( SR.DeviceFilterEditorDialog_WebConfigParsingError, e.Message ) ); } throw new FileLoadException( SR.GetString(SR.WebConfig_FileLoadException, e) ); } // Make sure web.config is checked out before we make changes. _webConfig.EnsureWebConfigCheckedOut(); // Insert the Device Filters into the List UI foreach (DeviceFilterNode filter in filters) { DeviceFilterTreeNode node = new DeviceFilterTreeNode(filter); _filterList.TvList.Nodes.Add(node); } // Make sure all filters have a name... // NOTE: Do not combine with the above loop or GetUniqueLabel() // will not necessarily be unique. It could be done if // we wrote another implementation of GetUniqueLabel() // that compared against filters [ArrayList returned // from ReadDeviceFilters()]. foreach (DeviceFilterTreeNode node in _filterList.TvList.Nodes) { if (String.IsNullOrEmpty(node.Text)) { node.Text = _filterList.GetUniqueLabel( SR.GetString(SR.DeviceFilterNode_DefaultFilterName) ); } } // Initialize the UI _rbCompare.Click += new EventHandler(OnClickCompareRadioButton); _rbDelegate.Click += new EventHandler(OnClickDelegateRadioButton); _cbCompare.TextChanged += new EventHandler(OnTextChanged); _cbCompare.SelectedIndexChanged += new EventHandler(OnTextChanged); _txtArgument.TextChanged += new EventHandler(OnTextChanged); _txtType.TextChanged += new EventHandler(OnTextChanged); _txtMethod.TextChanged += new EventHandler(OnTextChanged); _filterList.TvList.AfterLabelEdit += new NodeLabelEditEventHandler(OnAfterLabelEdit); _filterList.TvList.AfterSelect += new TreeViewEventHandler(OnFilterSelected); _filterList.BtnAdd.Click += new EventHandler(OnClickAddButton); _filterList.BtnRemove.Click += new EventHandler(OnClickRemoveButton); _filterList.TvList.SelectedNode = null; LoadAvailableCapabilities(); UpdateButtonsEnabling(); _dialogButtons.CmdOK.Click += new EventHandler(OnClickOK); _dialogButtons.CmdCancel.Click += new EventHandler(OnClickCancel); }
private void OnApplyFilter(Object sender, EventArgs e) { DeviceFilterNode filter = (DeviceFilterNode)_cbAvailableFilters.SelectedItem; if (filter == null) { String name = _cbAvailableFilters.Text; Debug.Assert( ((name != null) && (name.Length > 0)), "Should not be trying to apply a filter with none selected. " + "Missed a call to UpdateUI()?" ); // If the user typed the name of a filter which exists in their // web.config, we need to find the original rather than create // a new external filter. filter = FindAvailableFilter(name); if (filter == null) { /* Removed for DCR 4240 * if (!DesignerUtility.IsValidName(name)) * { * GenericUI.ShowWarningMessage( * SR.GetString(SR.AppliedDeviceFiltersDialog_Title), * SR.GetString( * SR.AppliedDeviceFiltersDialog_InvalidFilterName, * _cbAvailableFilters.Text * ) * ); * return; * } */ filter = CreateExternalFilter(_cbAvailableFilters.Text); } } ChoiceTreeNode choice = new ChoiceTreeNode( filter, _designer ); if (IsDefaultFilter(filter.Name)) { if (DefaultFilterIsApplied) { // Do not allow user to apply default filter if already // been applied. GenericUI.ShowWarningMessage( SR.GetString(SR.AppliedDeviceFiltersDialog_Title), SR.GetString(SR.AppliedDeviceFiltersDialog_DefaultFilterAlreadyApplied) ); } else { // Add the default filter to the end of the list and // remove it from list of available filters. _appliedFiltersList.TvList.Nodes.Add(choice); RemoveAvailableFilter(filter); } } else { // All other filters are added to the beginning _appliedFiltersList.TvList.Nodes.Insert(0, choice); } SetDirty(true); UpdateUI(); }