protected override object GetEditedValue(Control EditControl, string PropertyName, object oldValue, object currentObj) { ObjectWrapper placeHolder = currentObj as ObjectWrapper; if (placeHolder.SelectedObject is BSkyTextBox) { BSkyTextBox tb = placeHolder.SelectedObject as BSkyTextBox; //if (w.OverwriteVariables.is //tb.PromptforOverwrite= //w = new OverwriteSetting(tb.PromptforOverwrite); } else if (placeHolder.SelectedObject is DragDropList) { DragDropList dd = placeHolder.SelectedObject as DragDropList; // w = new OverwriteSetting(dd.PromptforOverwrite); } if (EditControl is OverwriteSettings) { OverwriteSettings w = EditControl as OverwriteSettings; //tb.PrefixTxt = w.PrefixString.Text; FrameworkElement selectedElement = currentObj as FrameworkElement; if (w.DialogResult.HasValue && w.DialogResult.Value) { return(w.OverwriteSetting); } return(oldValue); } return(false); }
protected override object GetEditedValue(Control EditControl, string PropertyName, object oldValue, object currentObj) { ObjectWrapper placeHolder = currentObj as ObjectWrapper; // DragDropList selectedElement = placeHolder.SelectedObject as DragDropList; BSkyTextBox tb = placeHolder.SelectedObject as BSkyTextBox; if (EditControl is textboxsubstitution) { textboxsubstitution w = EditControl as textboxsubstitution; tb.PrefixTxt = w.PrefixString.Text; FrameworkElement selectedElement = currentObj as FrameworkElement; if (w.DialogResult.HasValue && w.DialogResult.Value) { return(w.SubstituteSettings); } return(oldValue); } return(false); }
protected override Control GetEditControl(string PropName, object CurrentValue, object CurrentObj) { textboxsubstitution w; ObjectWrapper placeHolder = CurrentObj as ObjectWrapper; // DragDropList selectedElement = placeHolder.SelectedObject as DragDropList; BSkyTextBox tb = placeHolder.SelectedObject as BSkyTextBox; //Added by Aaron 10/10/2013 //This ensures that the variable filer dialog is opened with the correct filter settings for the number of //ordinal and nominal levels w = new textboxsubstitution(tb.PrefixTxt); if (CurrentValue == null) { w.SubstituteSettings = ""; } else { w.SubstituteSettings = CurrentValue.ToString(); } return(w); }
protected override Control GetEditControl(string PropName, object CurrentValue, object CurrentObj) { OverwriteSettings w; ObjectWrapper placeHolder = CurrentObj as ObjectWrapper; // DragDropList selectedElement = placeHolder.SelectedObject as DragDropList; if (placeHolder.SelectedObject is BSkyTextBox) { BSkyTextBox tb = placeHolder.SelectedObject as BSkyTextBox; w = new OverwriteSettings(tb.OverwriteSettings); } else { DragDropList dd = placeHolder.SelectedObject as DragDropList; w = new OverwriteSettings(dd.OverwriteSettings); } //if (CurrentValue == null) w.SubstituteSettings = ""; //else // w.SubstituteSettings = CurrentValue.ToString(); return(w); }
//Added by Aaron 07/20/2014 //this function looks at all the objects on the canvas recursively (for subdialogs) that contain the Overwrite settings property //The overwrite setting value controls whether the user should be prompted when creating a new variable or dataset and that variable or dataset already exists. public Boolean CheckForOverwrittenVars(BSkyCanvas cs) { System.Windows.Forms.DialogResult result; Boolean stopexecution = false; string message; foreach (object obj in cs.Children) { if (obj.GetType().Name == "BSkyTextBox") { BSkyTextBox tb = obj as BSkyTextBox; if (tb.OverwriteSettings == "PromptBeforeOverwritingVariables") { List <DataSourceVariable> varlst = UIController.GetActiveDocument().Variables; // UIController. //as=UIController.Re // List<DataSourceVariable> varlst = UIController. foreach (DataSourceVariable dsv in varlst) { // varnames = varnames + ", " + dsv.Name; if (dsv.Name == tb.Text) { message = "Do you want to overwrite variable " + tb.Text; result = System.Windows.Forms.MessageBox.Show(message, "Save Changes", System.Windows.Forms.MessageBoxButtons.YesNoCancel, System.Windows.Forms.MessageBoxIcon.Question); if (result == System.Windows.Forms.DialogResult.Yes)//save { } if (result == System.Windows.Forms.DialogResult.Cancel)//save { return(stopexecution = true); } if (result == System.Windows.Forms.DialogResult.No)//save { return(stopexecution = true); } } } } if (tb.OverwriteSettings == "PromptBeforeOverwritingDatasets") { // List<DataSourceVariable> varlst = UIController.GetActiveDocument().Variables; // UIController. //as=UIController.Re // List<DataSourceVariable> varlst = UIController. List <string> datasetnames; datasetnames = UIController.GetDatasetNames(); foreach (string dataset in datasetnames) { if (dataset == tb.Text) { message = "Do you want to overwrite dataset " + tb.Text; result = System.Windows.Forms.MessageBox.Show(message, "Save Changes", System.Windows.Forms.MessageBoxButtons.YesNoCancel, System.Windows.Forms.MessageBoxIcon.Question); if (result == System.Windows.Forms.DialogResult.Yes)//save { } if (result == System.Windows.Forms.DialogResult.Cancel)//save { return(stopexecution = true); } if (result == System.Windows.Forms.DialogResult.No)//save { return(stopexecution = true); } } } } } else if (obj.GetType().Name == "BSkyButton") { BSkyButton btn = obj as BSkyButton; FrameworkElement fe = obj as FrameworkElement; BSkyCanvas cnvs = fe.Resources["dlg"] as BSkyCanvas; // if (cs != null) ls.AddRange(gethelpfilenames(cs)); stopexecution = CheckForOverwrittenVars(cnvs); } } return(stopexecution); }