public void ExecuteSelectCommand(TemplateDialogViewModel t)
        {
            PageNumber++;

            // Only do something if user changed the template.  The user
            // might have simply pressed 'Back' and is now going forward
            // without changing to another template.
            if (SelectedTemplate != t)
            {
                SelectedTemplate = t;

                // Template was selected.
                View.Init(SelectedTemplate.View.Buffer);
                CodeBehindCSharp.Init(SelectedTemplate.CodeBehindCSharp.Buffer);
                ViewModelCSharp.Init(SelectedTemplate.ViewModelCSharp.Buffer);
                CodeBehindVisualBasic.Init(SelectedTemplate.CodeBehindVisualBasic.Buffer);
                ViewModelVisualBasic.Init(SelectedTemplate.ViewModelVisualBasic.Buffer);

                FieldValues.Init((ObservableCollection <FieldDialogViewModel>)t.Fields.SourceCollection);
            }
        }
        public void ExecuteOkCommand()
        {
            PageNumber++;
            switch (PageNumber)
            {
            case 3:
                // Field values were entered.
                GetFieldValues();

                View.ResetFieldValues(_predefinedFields, _customFields);
                CodeBehindCSharp.ResetFieldValues(_predefinedFields, _customFields);
                ViewModelCSharp.ResetFieldValues(_predefinedFields, _customFields);
                CodeBehindVisualBasic.ResetFieldValues(_predefinedFields, _customFields);
                ViewModelVisualBasic.ResetFieldValues(_predefinedFields, _customFields);
                break;

            case 4:

                break;
            }
        }
Пример #3
0
        private void ResetFieldValuesForAllBuffers()
        {
            CustomFieldValues = new List <InsertFieldViewModel>();
            foreach (var f in (ObservableCollection <FieldDialogViewModel>)Fields.SourceCollection)
            {
                object val;
                string type;
                // ReSharper disable once PossibleInvalidOperationException
                switch (f.SelectedFieldType.Value)
                {
                case FieldType.TextBox:
                case FieldType.TextBoxMultiLine:
                case FieldType.ComboBox:
                case FieldType.ComboBoxOpen:
                case FieldType.Class:
                    val  = f.DefaultString;
                    type = "System.String";
                    break;

                case FieldType.CheckBox:
                    val  = f.DefaultBoolean;
                    type = "System.Boolean";
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                CustomFieldValues.Add(InsertFieldViewModel.Create(Container, f.Name, type, f.Description, val));
            }

            View.ResetFieldValues(PredefinedFieldValues, CustomFieldValues);
            CodeBehindCSharp.ResetFieldValues(PredefinedFieldValues, CustomFieldValues);
            ViewModelCSharp.ResetFieldValues(PredefinedFieldValues, CustomFieldValues);
            CodeBehindVisualBasic.ResetFieldValues(PredefinedFieldValues, CustomFieldValues);
            ViewModelVisualBasic.ResetFieldValues(PredefinedFieldValues, CustomFieldValues);
        }