/// <summary> /// Handles the TitleChanged event of the expressionEditor control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Konesans.Dts.ExpressionEditor.Controls.TitleChangedEventArgs"/> instance containing the event data.</param> private void ExpressionEditor_TitleChanged(object sender, TitleChangedEventArgs e) { ExpressionEditorView editor = sender as ExpressionEditorView; if (editor != null) { if (e.Title == null) { this.Text = Application.ProductName; this.toolStripStatusLabelFilename.Text = "(New Expression)"; } else { if (editor.Saved) { this.Text = String.Format(CultureInfo.CurrentCulture, "{0} - {1}", e.Title, Application.ProductName); } else { this.Text = String.Format(CultureInfo.CurrentCulture, "{0}* - {1}", e.Title, Application.ProductName); } this.toolStripStatusLabelFilename.Text = editor.FileName; } this.saveToolStripButton.Enabled = !editor.Saved; this.saveToolStripMenuItem.Enabled = !editor.Saved; } }
private void DestroyExpressionControls() { if (_View != null) { Controls.Remove(_View); _View.Ok -= ExpressionView_Ok; _View.Cancel -= ExpressionView_Cancel; _View.Dispose(); _View = null; } }
public void StartEdit(object columnObject) { SuspendLayout(); column = columnObject; DestroyExpressionControls(); view = CreateExpressionControl(); Controls.Add(view); string expression = string.Empty; if (column is GridColumn) { expression = (column as GridColumn).UnboundExpression; } if (column is TreeListColumn) { expression = (column as TreeListColumn).UnboundExpression; } view.ExpressionString = UnboundExpressionConvertHelper.ConvertToCaption(columnContext, expression); ResumeLayout(); }
ExpressionEditorView CreateExpressionControl() { ExpressionEditorControl control = new ExpressionEditorControl(); if (column is GridColumn) { columnContext = new GridColumnIDataColumnInfoWrapper(column as GridColumn, GridColumnIDataColumnInfoWrapperEnum.ExpressionEditor); } if (column is TreeListColumn) { columnContext = column as IDataColumnInfo; } control.Context = ExpressionEditorHelper.GetExpressionEditorContext(LookAndFeel, columnContext); ExpressionEditorView expressionView = new ExpressionEditorView(control.LookAndFeel, control); expressionView.Dock = System.Windows.Forms.DockStyle.Fill; expressionView.TopLevel = false; expressionView.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; expressionView.Ok += ExpressionView_Ok; expressionView.Cancel += ExpressionView_Cancel; expressionView.Visible = true; return(expressionView); }
private ExpressionEditorView CreateExpressionControl() { var control = new ExpressionEditorControl(); if (_Column is GridColumn gridColumn) { _ColumnContext = new GridColumnIDataColumnInfoWrapper(gridColumn, GridColumnIDataColumnInfoWrapperEnum.ExpressionEditor); } if (_Column is TreeListColumn) { _ColumnContext = _Column as IDataColumnInfo; } control.Context = ExpressionEditorHelper.GetExpressionEditorContext(LookAndFeel, _ColumnContext); var expressionView = new ExpressionEditorView(control.LookAndFeel, control) { Dock = DockStyle.Fill, TopLevel = false, FormBorderStyle = FormBorderStyle.None }; expressionView.Ok += ExpressionView_Ok; expressionView.Cancel += ExpressionView_Cancel; expressionView.Visible = true; if (FindChildControl(expressionView, "okButton") is SimpleButton btnOK) { btnOK.Text = "Commit"; btnOK.ToolTip = "Save changes for editing column."; } if (FindChildControl(expressionView, "cancelButton") is SimpleButton btnCancel) { btnCancel.Text = "Rollback"; btnCancel.ToolTip = "Rollback changes for editing column."; } return(expressionView);