Example #1
0
        private void CreateProperty()
        {
            _propertyDialog.View.PropertyName = string.Empty;
            _propertyDialog.View.PropertyType = SchemaDataType.String;

            if (_propertyDialog.ShowDialog(this) == DialogResult.OK)
            {
                var propertyName = _propertyDialog.View.PropertyName;
                var propertyType = _propertyDialog.View.PropertyType;

                var propertyNode = CreatePropertyNode(DataSourceTree.SelectedNode, propertyName, propertyType);

                DataSourceTree.SelectedNode = propertyNode;
            }
        }
Example #2
0
        /// <summary>
        /// Display a custom modal dialog box to the user.
        /// </summary>
        /// <param name="viewModel">The viewmodel for the dialog.</param>
        /// <returns></returns>
        public bool?ShowDialog(IDialogViewModel viewModel)
        {
            var view    = new DialogView(viewModel);
            var dResult = view.ShowDialog(Owner);

            return(dResult);
        }
        public bool?ShowDialog(string title, object datacontext)
        {
            var dlg = new DialogView {
                DataContext = datacontext
            };

            return(dlg.ShowDialog());
        }
Example #4
0
        public T OpenDialog <T>(DialogViewModelBase <T> viewModel)
        {
            IDialogWindow window = new DialogView {
                DataContext = viewModel
            };

            window.ShowDialog();
            return(viewModel.DialogResult);
        }
Example #5
0
        public void Mensagem(string mensagem, Action okAction = null, string titulo = "Aviso")
        {
            var dialogWindow = new DialogView(titulo, mensagem);
            var result       = dialogWindow.ShowDialog(Application.OpenForms[0]);

            if (result == DialogResult.OK)
            {
                okAction?.Invoke();
            }
        }
Example #6
0
        public void Confirmacao(string mensagem, Action okAction, string titulo = "Atenção")
        {
            var dialogWindow = new DialogView(titulo, mensagem);
            var result       = dialogWindow.ShowDialog(Application.OpenForms[0]);

            if (result == DialogResult.OK)
            {
                okAction?.Invoke();
            }
        }
        public void CreateParameter()
        {
            if (AllowEdit)
            {
                _parameterDialog.View.DataSources   = DataSources;
                _parameterDialog.View.ParameterInfo = null;

                if (_parameterDialog.ShowDialog(this) == DialogResult.OK)
                {
                    var newParameterInfo = _parameterDialog.View.ParameterInfo;

                    Parameters.Add(newParameterInfo);

                    UpdateParameterNode(newParameterInfo, null);

                    InvokeParameterCreated(newParameterInfo);
                }
            }
        }
        public bool TryGetConnectionString(out string connectionString)
        {
            if (_connectionDialog.ShowDialog() == DialogResult.OK)
            {
                connectionString = _connectionDialog.View.ConnectionString;
                return(true);
            }

            connectionString = null;
            return(false);
        }
Example #9
0
        public void ShowDialog(ViewModelBase viewModel)
        {
            var dialog = new DialogView()
            {
                DataContext = viewModel
            };

            dialog.Owner         = System.Windows.Application.Current.MainWindow;
            dialog.ShowInTaskbar = false;
            dialog.ShowDialog();
        }
        public void CreateTotal()
        {
            if (AllowEdit)
            {
                _totalDialog.View.Report     = Report;
                _totalDialog.View.DataBands  = GetDataBands();
                _totalDialog.View.PrintBands = GetPrintBands();
                _totalDialog.View.TotalInfo  = null;

                if (_totalDialog.ShowDialog(this) == DialogResult.OK)
                {
                    var newTotalInfo = _totalDialog.View.TotalInfo;

                    Totals.Add(newTotalInfo);

                    UpdateTotalNode(newTotalInfo, null);

                    InvokeTotalCreated(newTotalInfo);
                }
            }
        }
Example #11
0
        public void ShowDialog(ViewModelBase viewModel)
        {
            var dialog = new DialogView {
                DataContext = viewModel
            };

            dialog.Owner                 = System.Windows.Application.Current.MainWindow;
            dialog.SizeToContent         = SizeToContent.WidthAndHeight;
            dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            dialog.Title                 = viewModel.DisplayName;
            dialog.ShowDialog();
        }
Example #12
0
        /// <summary>
        /// Display a custom modal dialog box to the user.
        /// </summary>
        /// <param name="viewModel">The viewmodel for the dialog.</param>
        /// <returns></returns>
        public bool?ShowDialog(IDialogViewModel viewModel)
        {
            switch (viewModel)
            {
            case OpenFileDialogViewModel openVm:
                var openFileDialog = new OpenFileDialog()
                {
                    Title            = openVm.Title,
                    Filter           = openVm.Filter,
                    Multiselect      = openVm.MultiSelect,
                    InitialDirectory = openVm.InitialDirectory,
                };
                var openFileResult = openFileDialog.ShowDialog(Owner);
                if (openFileResult == true)
                {
                    openVm.FilePaths = openFileDialog.FileNames;
                }
                return(openFileResult);

            case SaveFileDialogViewModel saveVm:
                var saveFileDialog = new SaveFileDialog()
                {
                    Title            = saveVm.Title,
                    Filter           = saveVm.Filter,
                    InitialDirectory = saveVm.InitialDirectory,
                };
                var saveFileResult = saveFileDialog.ShowDialog(Owner);
                if (saveFileResult == true)
                {
                    saveVm.FilePath = saveFileDialog.FileName;
                }
                return(saveFileResult);

            case OpenFolderDialogViewModel folderVm:
                var openFolderDialog = new WPFFolderBrowserDialog()
                {
                    Title            = folderVm.Title,
                    InitialDirectory = folderVm.InitialDirectory,
                };
                var opneFolderResult = openFolderDialog.ShowDialog(Owner);
                if (opneFolderResult == true)
                {
                    folderVm.FolderPath = openFolderDialog.FileName;
                }
                return(opneFolderResult);

            default:
                var view    = new DialogView(viewModel);
                var dResult = view.ShowDialog(Owner);
                return(dResult);
            }
        }
Example #13
0
        public void ShowMessageBox(string message, string caption, string yesBtn = "OK", bool showNoBtn = false, string noBtn = "Cancel", BoxOperation operation = BoxOperation.Message, Action action = null)
        {
            var dialogViewModel = new DialogViewModel(message, caption, yesBtn, showNoBtn, noBtn, operation, action);

            var window = new DialogView()
            {
                DataContext           = dialogViewModel,
                Topmost               = true,
                Title                 = caption,
                ResizeMode            = ResizeMode.NoResize,
                Height                = 150,
                Width                 = 300,
                BorderBrush           = Brushes.LightBlue,
                WindowStartupLocation = WindowStartupLocation.CenterScreen,
            };

            window.ShowDialog();
        }
        private void MainMenuButtonPressed(MainMenuButton obj)
        {
            switch (obj)
            {
            case MainMenuButton.Unknown:
                break;

            case MainMenuButton.Members:
                ContentArea = new MembersViewModel();
                break;

            case MainMenuButton.Activities:
                ContentArea = new ActivitiesViewModel();
                break;

            case MainMenuButton.Finances:
                DialogView dw = new DialogView(new DialogReferentViewModel <MemberCategory>("Šifrarnik: članstvo"));
                dw.Owner = Application.Current.MainWindow;
                dw.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                dw.ShowDialog();
                break;

            case MainMenuButton.Documents:
                DialogView dw2 = new DialogView(new DialogReferentViewModel <MemberFunction>("Šifrarnik: funkcija"));
                dw2.Owner = Application.Current.MainWindow;
                dw2.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                dw2.ShowDialog();
                break;

            case MainMenuButton.Economat:
                break;

            case MainMenuButton.Home:
                ContentArea = new HomeViewModel();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(obj), obj, null);
            }
        }
Example #15
0
        private void SelectDataSourceProperty(Control propertyEditor)
        {
            if (DataSources != null)
            {
                var selectedDataSourceName = DataSourceEdit.Text;

                if (string.IsNullOrWhiteSpace(selectedDataSourceName) == false)
                {
                    var selectedDataSource = DataSources.FirstOrDefault(ds => ds.Name == selectedDataSourceName);

                    if (selectedDataSource != null)
                    {
                        _propertySelectForm.View.DataSourceName     = selectedDataSourceName;
                        _propertySelectForm.View.DataSourceSchema   = selectedDataSource.Schema;
                        _propertySelectForm.View.DataSourceProperty = propertyEditor.Text;

                        if (_propertySelectForm.ShowDialog(this) == DialogResult.OK)
                        {
                            propertyEditor.Text = _propertySelectForm.View.DataSourceProperty;
                        }
                    }
                }
            }
        }
        public override void OnReceive(Context context, Intent intent)
        {
            var device = (BluetoothDevice)intent.GetParcelableExtra(BluetoothDevice.ExtraDevice);

            Debug.WriteLine("Result of trying to pair with pager: " + device.BondState);

            var message = string.Empty;

            switch (device.BondState)
            {
            case Bond.Bonding:
                message = "Bonding with device...";
                break;

            case Bond.Bonded:
                message = "Successfuly Bonded";
                break;

            case Bond.None:
                message = "Failed To Bond";
                break;
            }
            DialogView.ShowDialog(message, _currentActivity);
        }
Example #17
0
        private static ParameterValueEditor EditorWithManualMultipleSelect(ParameterInfo parameterInfo)
        {
            // Выбор нескольких значений из вручную сформированного списка

            var parameterValueControl = EditorFactory.CreateArrayEditor(parameterInfo.Type);
            var parameterValueEditor  = EditorFactory.CreateSimpleEditor(parameterInfo.Type);
            var selectValueView       = new SelectMultipleValueView(parameterValueEditor);
            var selectValueDlg        = new DialogView <SelectMultipleValueView>(selectValueView);

            var editor = new ParameterValueEditor(parameterValueControl)
            {
                ShowNullButton   = false,
                ShowSelectButton = true
            };

            editor.ChangingValue += (sender, args) =>
            {
                args.Value = parameterValueControl.CastArrayValue(args.Value as IEnumerable);
                args.Label = parameterValueControl.FormatArrayValue(args.Value as IEnumerable);
            };

            editor.SelectValue += (sender, args) =>
            {
                args.Cancel = true;

                selectValueDlg.View.SelectedValues = editor.Value as IEnumerable;

                if (selectValueDlg.ShowDialog() == DialogResult.OK)
                {
                    args.Value  = selectValueDlg.View.SelectedValues;
                    args.Cancel = false;
                }
            };

            return(editor);
        }
Example #18
0
 public bool ShowDialog(DialogModel model, string dialogTitle)
 {
     view.DataContext = dialogVM;
     view.Title       = dialogTitle;
     return((bool)view.ShowDialog());
 }
Example #19
0
        private static ParameterValueEditor EditorWithSingleSelect(ParameterInfo parameterInfo)
        {
            // Выбор одного значения из предопределенного списка

            var parameterValueControl = EditorFactory.CreateObjectEditor(parameterInfo.Type);
            var selectValueDlg        = new DialogView <SelectSingleValueView>();

            var editor = new ParameterValueEditor(parameterValueControl)
            {
                ShowNullButton   = false,
                ShowSelectButton = true
            };

            editor.ChangingValue += (sender, args) =>
            {
                // Устанавливаем значение, только если оно есть в списке

                object newValue = null;
                string newLabel = null;

                if (editor.AvailableValues.IsNullOrEmpty() == false)
                {
                    var selectedValue = parameterValueControl.CastObjectValue(ValueOrFirstItem(args.Value));

                    if (selectedValue != null)
                    {
                        foreach (var item in editor.AvailableValues)
                        {
                            if (Equals(item.Value, selectedValue))
                            {
                                newValue = item.Value;
                                newLabel = item.Key;
                                break;
                            }
                        }
                    }
                }

                args.Value = newValue;
                args.Label = newLabel;
            };

            editor.SelectValue += (sender, args) =>
            {
                // Показываем диалог, только если есть доступные значения

                args.Cancel = true;

                if (editor.AvailableValues.IsNullOrEmpty() == false)
                {
                    selectValueDlg.View.AvailableValues = editor.AvailableValues;
                    selectValueDlg.View.SelectedValue   = editor.Value;

                    if (selectValueDlg.ShowDialog() == DialogResult.OK)
                    {
                        args.Value  = selectValueDlg.View.SelectedValue;
                        args.Cancel = false;
                    }
                }
            };

            return(editor);
        }
Example #20
0
        private static ParameterValueEditor EditorWithMultipleSelect(ParameterInfo parameterInfo)
        {
            // Выбор нескольких значений из предопределенного списка

            var parameterValueControl = EditorFactory.CreateArrayEditor(parameterInfo.Type);
            var selectValueDlg        = new DialogView <SelectMultipleValueView>();

            var editor = new ParameterValueEditor(parameterValueControl)
            {
                ShowNullButton   = false,
                ShowSelectButton = true
            };

            editor.ChangingValue += (sender, args) =>
            {
                // Выбираем значения, только если они есть в списке

                object newValue = null;
                string newLabel = null;

                if (editor.AvailableValues.IsNullOrEmpty() == false)
                {
                    var selectedValues = parameterValueControl.CastArrayValue(args.Value as IEnumerable);

                    if (selectedValues != null)
                    {
                        var allowSelectedValues = new List <object>();
                        var allowSelectedLabels = new List <string>();

                        foreach (var value in selectedValues)
                        {
                            foreach (var item in editor.AvailableValues)
                            {
                                if (Equals(item.Value, value))
                                {
                                    allowSelectedValues.Add(item.Value);
                                    allowSelectedLabels.Add(item.Key);
                                    break;
                                }
                            }
                        }

                        if (allowSelectedValues.Count > 0)
                        {
                            newValue = allowSelectedValues;
                            newLabel = parameterValueControl.FormatArrayValue(allowSelectedLabels, false);
                        }
                    }
                }

                args.Value = newValue;
                args.Label = newLabel;
            };

            editor.SelectValue += (sender, args) =>
            {
                // Показываем диалог, только если есть доступные значения

                args.Cancel = true;

                if (editor.AvailableValues.IsNullOrEmpty() == false)
                {
                    selectValueDlg.View.AvailableValues = editor.AvailableValues;
                    selectValueDlg.View.SelectedValues  = editor.Value as IEnumerable;

                    if (selectValueDlg.ShowDialog() == DialogResult.OK)
                    {
                        args.Value  = selectValueDlg.View.SelectedValues;
                        args.Cancel = false;
                    }
                }
            };

            return(editor);
        }
Example #21
0
        public DialogResult ShowDialog(IWin32Window owner)
        {
            var result = DialogResult.Cancel;

            if (DataSourceInfo != null)
            {
                if (DataSourceInfo.Provider is RegisterDataProviderInfo)
                {
                    _registerDataSourceView.DataSourceInfo = DataSourceInfo;
                    _registerDataSourceDialog.View         = _registerDataSourceView;

                    result = _registerDataSourceDialog.ShowDialog(owner);

                    if (result == DialogResult.OK)
                    {
                        DataSourceInfo = _registerDataSourceView.DataSourceInfo;
                    }
                }
                else if (DataSourceInfo.Provider is RestDataProviderInfo)
                {
                    _restDataSourceView.DataSourceInfo = DataSourceInfo;
                    _restDataSourceDialog.View         = _restDataSourceView;

                    result = _restDataSourceDialog.ShowDialog(owner);

                    if (result == DialogResult.OK)
                    {
                        DataSourceInfo = _restDataSourceView.DataSourceInfo;
                    }
                }
                else if (DataSourceInfo.Provider is SqlDataProviderInfo)
                {
                    var sqlProvider = (SqlDataProviderInfo)DataSourceInfo.Provider;

                    if (sqlProvider.ServerType == SqlServerType.MsSqlServer)
                    {
                        _msSqlTableSelectDialog.View        = _msSqlTableSelectView;
                        _msSqlDataSourceView.DataSourceInfo = DataSourceInfo;
                        _msSqlDataSourceDialog.View         = _msSqlDataSourceView;

                        result = _msSqlDataSourceDialog.ShowDialog(owner);

                        if (result == DialogResult.OK)
                        {
                            DataSourceInfo = _msSqlDataSourceView.DataSourceInfo;
                        }
                    }
                    else if (sqlProvider.ServerType == SqlServerType.Firebird)
                    {
                        _firebirdTableSelectDialog.View        = _firebirdTableSelectView;
                        _firebirdDataSourceView.DataSourceInfo = DataSourceInfo;
                        _firebirdDataSourceDialog.View         = _firebirdDataSourceView;

                        result = _firebirdDataSourceDialog.ShowDialog(owner);

                        if (result == DialogResult.OK)
                        {
                            DataSourceInfo = _firebirdDataSourceView.DataSourceInfo;
                        }
                    }
                }
            }
            else
            {
                _wizardView.Reset();

                result = _wizardView.ShowDialog(owner);
            }

            return(result);
        }