コード例 #1
0
        private string QueryProfileName(string profileName)
        {
            var f = new InputBoxWindow();

            f.IsValidInput = ViewModel.ProfilenameIsValid;
            f.QuestionText = TranslationHelper.TranslatorInstance.GetTranslation("ProfileSettingsWindow", "EnterProfileName",
                                                                                 "Please enter profile name:");

            if (profileName != null)
            {
                f.InputText = profileName;
            }
            else
            {
                f.InputText = TranslationHelper.TranslatorInstance.GetTranslation("ProfileSettingsWindow", "NewProfile", "New Profile");
            }

            f.Title = TranslationHelper.TranslatorInstance.GetTranslation("ProfileSettingsWindow", "ProfileName", "Profile name");

            if (f.ShowDialog() != true)
            {
                return(null);
            }

            return(f.InputText);
        }
コード例 #2
0
        private void AddGlobalParam(object sender, RoutedEventArgs e)
        {
            GlobalAppModelParameter newModelGlobalParam = new GlobalAppModelParameter();

            SetUniquePlaceHolderName(newModelGlobalParam);

            string newParamPlaceholder = newModelGlobalParam.PlaceHolder;

            while (InputBoxWindow.GetInputWithValidation("Add Model Global Parameter", "Parameter Name:", ref newParamPlaceholder, System.IO.Path.GetInvalidPathChars().Where(c => c != '<' && c != '>').ToArray <char>()))
            {
                newModelGlobalParam.PlaceHolder = newParamPlaceholder;
                if (!IsParamPlaceholderNameConflict(newModelGlobalParam))
                {
                    newModelGlobalParam.OptionalValuesList.Add(new OptionalValue()
                    {
                        Value = GlobalAppModelParameter.CURRENT_VALUE, IsDefault = true
                    });
                    WorkSpace.Instance.SolutionRepository.AddRepositoryItem(newModelGlobalParam);
                    newModelGlobalParam.StartDirtyTracking();

                    //making sure rows numbers are ok
                    xModelsGlobalParamsGrid.Grid.UpdateLayout();
                    xModelsGlobalParamsGrid.Renum();
                    break;
                }
            }
        }
コード例 #3
0
        private void AddFileToDatabase(DatabaseReference database)
        {
            var dialog = new OpenFileDialog()
            {
                Filter      = "All files|*.*",
                Multiselect = false
            };

            if (dialog.ShowDialog() != true)
            {
                return;
            }

            try
            {
                if (InputBoxWindow.ShowDialog("New file id:", "Enter new file id", Path.GetFileName(dialog.FileName), out string id) == true)
                {
                    var file = database.AddFile(id, dialog.FileName);
                    SelectedCollection = database.Collections.First(a => a.Name == "_files");
                    ListCollectionData.SelectedItem = file;
                    ListCollectionData.ScrollIntoView(ListCollectionData.SelectedItem);
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(
                    "Failed to upload file:" + Environment.NewLine + exc.Message,
                    "Database error",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error
                    );
            }
        }
コード例 #4
0
        private void RenameTreeFolderHandler(object sender, System.Windows.RoutedEventArgs e)
        {
            string originalName  = mTreeView.Tree.GetSelectedTreeNodeName();
            string newFolderName = originalName;

            if (InputBoxWindow.GetInputWithValidation("Rename Folder", "New Folder Name:", ref newFolderName, System.IO.Path.GetInvalidPathChars()))
            {
                if (!String.IsNullOrEmpty(newFolderName))
                {
                    string path = Path.Combine(Path.GetDirectoryName(this.NodePath().TrimEnd('\\', '/')), newFolderName);
                    if (System.IO.Directory.Exists(path) == true && originalName.ToUpper() != newFolderName.ToUpper())
                    {
                        Reporter.ToUser(eUserMsgKey.FolderExistsWithName);
                        return;
                    }
                    else
                    {
                        try
                        {
                            if (RenameTreeFolder(originalName, newFolderName, path) == false)
                            {
                                Reporter.ToUser(eUserMsgKey.RenameItemError, path);
                                return;
                            }
                        }
                        catch (Exception ex)
                        {
                            Reporter.ToUser(eUserMsgKey.RenameItemError, ex.Message);
                            Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex);
                            return;
                        }
                    }
                }
            }
        }
コード例 #5
0
        private void Rename_Click(object sender, RoutedEventArgs e)
        {
            string oldName = mDSTableDetails.Name;

            InputBoxWindow.OpenDialog("Rename", "Table Name:", mDSTableDetails, DataSourceBase.Fields.Name);
            mDSTableDetails.DSC.RenameTable(oldName, mDSTableDetails.Name);
        }
コード例 #6
0
        public static RunSetConfig CreateNewRunset(string runSetName = "", RepositoryFolder <RunSetConfig> runSetsFolder = null)
        {
            if (string.IsNullOrEmpty(runSetName))
            {
                if (!InputBoxWindow.GetInputWithValidation(string.Format("Add New {0}", GingerDicser.GetTermResValue(eTermResKey.RunSet)), string.Format("{0} Name:", GingerDicser.GetTermResValue(eTermResKey.RunSet)), ref runSetName, System.IO.Path.GetInvalidPathChars()))
                {
                    return(null);
                }
            }

            RunSetConfig runSetConfig = new RunSetConfig();

            runSetConfig.Name = runSetName;
            runSetConfig.GingerRunners.Add(new GingerRunner()
            {
                Name = "Runner 1"
            });

            if (runSetsFolder == null)
            {
                WorkSpace.Instance.SolutionRepository.AddRepositoryItem(runSetConfig);
            }
            else
            {
                runSetsFolder.AddRepositoryItem(runSetConfig);
            }

            return(runSetConfig);
        }
        private void btnShotClockSet_Click(object sender, RoutedEventArgs e)
        {
            var ibw = new InputBoxWindow(
                "Enter the shot clock left:", SQLiteIO.GetSetting("LastShotClockSet", "0.0"), "NBA Stats Tracker");

            if (ibw.ShowDialog() == false)
            {
                return;
            }

            var shotClock = _shotClock;

            try
            {
                shotClock = ConvertTimeStringToDouble(InputBoxWindow.UserInput);
            }
            catch
            {
                return;
            }

            _shotClock = shotClock;
            updateShotClockIndication(_shotClock);
            SQLiteIO.SetSetting("LastShotClockSet", InputBoxWindow.UserInput);
        }
コード例 #8
0
        public Task <Result <CollectionDocumentChangeEventArgs> > AddFileToDatabase(DatabaseReference database)
        {
            var dialog = new OpenFileDialog
            {
                Filter      = "All files|*.*",
                Multiselect = false
            };

            if (dialog.ShowDialog() != true)
            {
                return(Task.FromResult(Result.Fail <CollectionDocumentChangeEventArgs>("FILE_OPEN_CANCELED")));
            }

            try
            {
                if (InputBoxWindow.ShowDialog("New file id:", "Enter new file id", Path.GetFileName(dialog.FileName),
                                              out string id) == true)
                {
                    var file = database.AddFile(id, dialog.FileName);

                    var documentsCreated = new CollectionDocumentChangeEventArgs(ReferenceNodeChangeAction.Add, new [] { file }, file.Collection);

                    _eventAggregator.PublishOnUIThread(documentsCreated);

                    return(Task.FromResult(Result.Ok(documentsCreated)));
                }
            }
            catch (Exception exc)
            {
                _applicationInteraction.ShowError(exc, "Failed to upload file:" + Environment.NewLine + exc.Message, "Database error");
            }


            return(Task.FromResult(Result.Fail <CollectionDocumentChangeEventArgs>("FILE_OPEN_FAIL")));
        }
コード例 #9
0
        public Result AddFileToDatabase(DatabaseReference database)
        {
            var dialog = new OpenFileDialog
            {
                Filter      = "All files|*.*",
                Multiselect = false
            };

            if (dialog.ShowDialog() != true)
            {
                return(Result.Fail("FILE_OPEN_CANCELED"));
            }

            try
            {
                if (InputBoxWindow.ShowDialog("New file id:", "Enter new file id", Path.GetFileName(dialog.FileName),
                                              out string id) == true)
                {
                    var file = database.AddFile(id, dialog.FileName);
                    Store.Current.SelectCollection(database.Collections.First(a => a.Name == "_files"));
                    Store.Current.SelectDocument(file);

                    return(Result.Ok());
                }
            }
            catch (Exception exc)
            {
                ErrorInteraction("Failed to upload file:" + Environment.NewLine + exc.Message);
            }


            return(Result.Fail("FILE_OPEN_FAIL"));
        }
コード例 #10
0
        public Result <InteractionEvents.CollectionDocumentsCreated> AddFileToDatabase(DatabaseReference database)
        {
            var dialog = new OpenFileDialog
            {
                Filter      = "All files|*.*",
                Multiselect = false
            };

            if (dialog.ShowDialog() != true)
            {
                return(Result.Fail <InteractionEvents.CollectionDocumentsCreated>("FILE_OPEN_CANCELED"));
            }

            try
            {
                if (InputBoxWindow.ShowDialog("New file id:", "Enter new file id", Path.GetFileName(dialog.FileName),
                                              out string id) == true)
                {
                    var file = database.AddFile(id, dialog.FileName);

                    var documentsCreated = new InteractionEvents.CollectionDocumentsCreated(file.Collection, new [] { file });

                    return(Result.Ok(documentsCreated));
                }
            }
            catch (Exception exc)
            {
                ErrorInteraction("Failed to upload file:" + Environment.NewLine + exc.Message);
            }


            return(Result.Fail <InteractionEvents.CollectionDocumentsCreated>("FILE_OPEN_FAIL"));
        }
コード例 #11
0
        private void AddActivity()
        {
            Activity activity = new Activity();
            bool     b        = InputBoxWindow.OpenDialog("Add new Activity", "Activity Name", activity, nameof(Activity.ActivityName));

            if (b)
            {
                mBusinessFlow.Activities.Add(activity);
            }
        }
コード例 #12
0
        private void miRename_Click(object sender, RoutedEventArgs e)
        {
            CheckSelectedItem();
            string newTitle = InputBoxWindow.ShowDlg("条目重命名", CurrentUri, "");

            if (newTitle != null && newTitle.Length > 0)
            {
                uriDB.UpdateTitle(CurrentUri, newTitle);
            }
        }
コード例 #13
0
        public static RunSetConfig CreateNewRunset(string runSetName = "", RepositoryFolder <RunSetConfig> runSetsFolder = null)
        {
            if (string.IsNullOrEmpty(runSetName))
            {
                do
                {
                    if (!string.IsNullOrEmpty(runSetName.Trim()))
                    {
                        Reporter.ToUser(eUserMsgKey.DuplicateRunsetName, runSetName);
                    }

                    bool returnWindow = InputBoxWindow.OpenDialog(string.Format("Add New {0}", GingerDicser.GetTermResValue(eTermResKey.RunSet)),
                                                                  string.Format("{0} Name:", GingerDicser.GetTermResValue(eTermResKey.RunSet)),
                                                                  ref runSetName);

                    if (returnWindow)
                    {
                        if (string.IsNullOrEmpty(runSetName.Trim()))
                        {
                            Reporter.ToUser(eUserMsgKey.ValueIssue, "Value cannot be empty");
                        }
                    }
                    else
                    {
                        return(null);
                    }
                }while (string.IsNullOrEmpty(runSetName.Trim()) || WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <RunSetConfig>().Where(r => r.ItemName.ToLower() == runSetName.ToLower()).FirstOrDefault() != null);
            }

            RunSetConfig runSetConfig = new RunSetConfig();

            runSetConfig.Name = runSetName;

            GingerRunner gingerRunner = new GingerRunner {
                Name = "Runner 1"
            };
            GingerExecutionEngine gingerExecutionEngine = new GingerExecutionEngine(gingerRunner);

            gingerRunner.Executor = gingerExecutionEngine;

            runSetConfig.GingerRunners.Add(gingerRunner);
            runSetConfig.AddCategories();

            if (runSetsFolder == null)
            {
                WorkSpace.Instance.SolutionRepository.AddRepositoryItem(runSetConfig);
            }
            else
            {
                runSetsFolder.AddRepositoryItem(runSetConfig);
            }

            return(runSetConfig);
        }
コード例 #14
0
        public Task <Maybe <string> > ShowInputDialog(string message, string caption = "", string predefined = "", Func <string, Result> validationFunc = null)
        {
            var completionSource = new TaskCompletionSource <Maybe <string> >();

            completionSource.SetResult(
                InputBoxWindow.ShowDialog(message, caption, predefined, validationFunc, out var inputText) == true
                    ? inputText
                    : Maybe <string> .None);

            return(completionSource.Task);
        }
コード例 #15
0
ファイル: ObjectGenerationHelper.cs プロジェクト: kijun/art
    public static void RequestFloat(string message, string defaultValue, FloatInputDelegate del)
    {
        InputBoxWindow window = ScriptableObject.CreateInstance <InputBoxWindow>();

        window.position      = new Rect(Screen.width / 2, Screen.height / 2, 250, 150);
        window.message       = message;
        window.floatDelegate = del;
        window.inputValue    = defaultValue;
        window.ShowPopup();
        window.Focus();
    }
コード例 #16
0
 private void AddSingleAPIModel(ApplicationAPIUtils.eWebApiType type)
 {
     string apiName = string.Empty; ;
     if (InputBoxWindow.GetInputWithValidation(string.Format("Add {0} API",type.ToString()), "API Name:", ref apiName, System.IO.Path.GetInvalidPathChars()))
     {
         ApplicationAPIModel newApi = new ApplicationAPIModel();
         newApi.APIType = type;
         newApi.Name = apiName;
         newApi.ContainingFolder = mAPIModelFolder.FolderFullPath;              
         mAPIModelFolder.AddRepositoryItem(newApi);                            
     }
 }
コード例 #17
0
        public static string Show(string prompt, string caption, bool filterInput = false)
        {
            string returnString = string.Empty;

            InputBoxWindow inputBoxWindow = new InputBoxWindow(prompt, caption, filterInput);

            inputBoxWindow.ShowDialog();

            returnString = inputBoxWindow.UserInput;

            return(returnString);
        }
コード例 #18
0
 public bool RenameItem(string Title, Object obj, string Property)
 {
     // hard coded biz flow name... Check me
     if (InputBoxWindow.OpenDialog("Rename", Title, obj, Property))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #19
0
        private void Rename_Click(object sender, RoutedEventArgs e)
        {
            if (Reporter.ToUser(eUserMsgKey.SaveLocalChanges) == Amdocs.Ginger.Common.eUserMsgSelection.No)
            {
                return;
            }
            string oldName = mDSTableDetails.Name;

            InputBoxWindow.OpenDialog("Rename", "Table Name:", mDSTableDetails, DataSourceBase.Fields.Name);
            mDSTableDetails.DSC.RenameTable(oldName, mDSTableDetails.Name);
            RefreshGrid();
            mDSTableDetails.DirtyStatus = Amdocs.Ginger.Common.Enums.eDirtyStatus.NoChange;
        }
コード例 #20
0
 public void AddCollectionToSelectedDatabase()
 {
     try
     {
         if (InputBoxWindow.ShowDialog("New collection name:", "Enter new collection name", "", out string name) == true)
         {
             Store.Current.SelectedDatabase.AddCollection(name);
         }
     }
     catch (Exception exc)
     {
         ErrorInteraction("Failed to add new collection:" + Environment.NewLine + exc.Message);
     }
 }
コード例 #21
0
 public void RenameSelectedCollection()
 {
     try
     {
         if (InputBoxWindow.ShowDialog("New name:", "Enter new collection name", Store.Current.SelectedCollection.Name, out string name) == true)
         {
             Store.Current.SelectedDatabase.RenameCollection(Store.Current.SelectedCollection.Name, name);
         }
     }
     catch (Exception exc)
     {
         ErrorInteraction("Failed to rename collection:" + Environment.NewLine + exc.Message);
     }
 }
コード例 #22
0
        private void MergeSelectedParams(object sender, RoutedEventArgs e)
        {
            if (ModelParametersGrid.Grid.SelectedItems.Count < 1)
            {
                return;
            }

            string newParamName = ((AppModelParameter)ModelParametersGrid.Grid.SelectedItems[0]).PlaceHolder;

            if (InputBoxWindow.GetInputWithValidation("Merge Parameters", "Set Palceholder for Merged Parameters", ref newParamName, new char[0]))
            {
                //Create new Merged param
                AppModelParameter mergedParam = new AppModelParameter();
                mergedParam.PlaceHolder = newParamName;

                //Merged optional values
                SetMergedOptionalValues(mergedParam);

                //Set Grid selected index
                int selctedIndex = ModelParametersGrid.Grid.SelectedIndex;

                List <string> placeHoldersToReplace = new List <string>();
                //Save Placeholders and remove old params for merge, and add the new merged one

                List <AppModelParameter> tobeRemoved = new List <AppModelParameter>();
                for (int i = 0; i < ModelParametersGrid.Grid.SelectedItems.Count; i++)
                {
                    AppModelParameter paramToRemove = (AppModelParameter)ModelParametersGrid.Grid.SelectedItems[i];
                    placeHoldersToReplace.Add(paramToRemove.PlaceHolder);
                    tobeRemoved.Add(paramToRemove);
                }

                foreach (AppModelParameter Removeit in tobeRemoved)
                {
                    mAAMB.AppModelParameters.Remove(Removeit);
                }

                mAAMB.AppModelParameters.Add(mergedParam);
                GingerCore.General.DoEvents();
                ModelParametersGrid.DataSourceList.Move(ModelParametersGrid.DataSourceList.Count - 1, selctedIndex);

                //Update all places with new placeholder merged param name
                //TODO: Fix with New Reporter (on GingerWPF)
                if (System.Windows.MessageBox.Show(string.Format("Do you want to update the merged instances on all model configurations?"), "Models Parameters Merge", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Warning, System.Windows.MessageBoxResult.No) == System.Windows.MessageBoxResult.Yes)
                {
                    mAAMB.UpdateParamsPlaceholder(mAAMB, placeHoldersToReplace, newParamName);
                }
            }
        }
コード例 #23
0
        private string RequestPrinternameFromUser(string questionText, string printerName)
        {
            var w = new InputBoxWindow();

            w.IsValidInput = ValidatePrinterName;
            w.QuestionText = questionText;
            w.InputText    = printerName;

            if (w.ShowDialog() != true)
            {
                return(null);
            }

            return(w.InputText);
        }
コード例 #24
0
        private void Rename_Click(object sender, RoutedEventArgs e)
        {
            if (Reporter.ToUser(eUserMsgKey.SaveLocalChanges) == Amdocs.Ginger.Common.eUserMsgSelection.No)
            {
                return;
            }

            string newName = mDSTableDetails.Name;

            InputBoxWindow.OpenDialog("Rename", "Table Name:", ref newName);

            ValidateAndUpdateDBTableName(newName);

            mDSTableDetails.DirtyStatus = Amdocs.Ginger.Common.Enums.eDirtyStatus.NoChange;
        }
コード例 #25
0
        private void MergeSelectedParams(object sender, RoutedEventArgs e)
        {
            if (ModelParametersGrid.Grid.SelectedItems.Count < 1)
            {
                return;
            }

            string newParamName = ((AppModelParameter)ModelParametersGrid.Grid.SelectedItems[0]).PlaceHolder;

            if (InputBoxWindow.GetInputWithValidation("Merge Parameters", "Set Placeholder for Merged Parameters", ref newParamName, new char[0]))
            {
                //Create new Merged param
                AppModelParameter mergedParam = new AppModelParameter();
                mergedParam.PlaceHolder = newParamName;

                //Merged optional values
                SetMergedOptionalValues(mergedParam);

                //Set Grid selected index
                int selctedIndex = ModelParametersGrid.Grid.SelectedIndex;

                List <string> placeHoldersToReplace = new List <string>();
                //Save Placeholders and remove old params for merge, and add the new merged one

                List <AppModelParameter> tobeRemoved = new List <AppModelParameter>();
                for (int i = 0; i < ModelParametersGrid.Grid.SelectedItems.Count; i++)
                {
                    AppModelParameter paramToRemove = (AppModelParameter)ModelParametersGrid.Grid.SelectedItems[i];
                    placeHoldersToReplace.Add(paramToRemove.PlaceHolder);
                    tobeRemoved.Add(paramToRemove);
                }

                foreach (AppModelParameter Removeit in tobeRemoved)
                {
                    mApplicationModel.AppModelParameters.Remove(Removeit);
                }

                mApplicationModel.AppModelParameters.Add(mergedParam);
                GingerCore.General.DoEvents();
                ModelParametersGrid.DataSourceList.Move(ModelParametersGrid.DataSourceList.Count - 1, selctedIndex);

                //Update all places with new placeholder merged param name
                if (Reporter.ToUser(eUserMsgKeys.ParameterMerge) == Amdocs.Ginger.Common.MessageBoxResult.Yes)
                {
                    mApplicationModel.UpdateParamsPlaceholder(mApplicationModel, placeHoldersToReplace, newParamName);
                }
            }
        }
コード例 #26
0
        private string QueryLicenseKey()
        {
            var inputBoxWindow = new InputBoxWindow();

            inputBoxWindow.Title        = _translator.GetTranslation("pdfforge.PDFCreator.Shared.Views.UserControls.LicenseTab", "EnterLicenseKeyButton.Text", "Enter new License Key");
            inputBoxWindow.QuestionText = _translator.GetTranslation("pdfforge.PDFCreator.Shared.ViewModels.UserControls.LicenseTabViewModel", "EnterLicenseKeyText", "Please enter your License key:");
            inputBoxWindow.InputText    = LicenseKey;
            inputBoxWindow.IsValidInput = ValidateLicenseKey;

            if (inputBoxWindow.ShowDialog() != true)
            {
                return(null);
            }

            return(inputBoxWindow.InputText);
        }
コード例 #27
0
        public void OpenDatabase(string path)
        {
            if (Databases.FirstOrDefault(a => a.Location == path) != null)
            {
                return;
            }

            if (!File.Exists(path))
            {
                MessageBox.Show(
                    "Cannot open database, file not found.",
                    "File not found",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error);
                return;
            }

            string password = null;

            if (DatabaseReference.IsDbPasswordProtected(path))
            {
                if (InputBoxWindow.ShowDialog("Database is password protected, enter password:"******"Database password.", "", out password) != true)
                {
                    return;
                }
            }

            if (PathDefinitions.RecentFiles.Contains(path))
            {
                PathDefinitions.RecentFiles.Remove(path);
            }

            PathDefinitions.RecentFiles.Insert(0, path);

            try
            {
                Databases.Add(new DatabaseReference(path, password));
            }
            catch (Exception e)
            {
                MessageBox.Show("Failed to open database:" + Environment.NewLine + e.Message, "Database Error", MessageBoxButton.OK, MessageBoxImage.Error);
                logger.Error(e, "Failed to process update: ");
                return;
            }
        }
コード例 #28
0
        /// <summary>Handles the Click event of the btnAdd control. Allows the user to add a new item.</summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">
        ///     The <see cref="RoutedEventArgs" /> instance containing the event data.
        /// </param>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            var ibw = new InputBoxWindow("Enter the name for the new conference:");

            if (ibw.ShowDialog() == true)
            {
                var name = InputBoxWindow.UserInput.Replace(':', '-');
                if (MainWindow.Conferences.Any(conference => conference.Name == name))
                {
                    MessageBox.Show("There's already a conference with the name " + name + ".");
                    return;
                }
                var usedIDs = new List <int>();
                MainWindow.Conferences.ForEach(conference => usedIDs.Add(conference.ID));
                var i = 0;
                while (usedIDs.Contains(i))
                {
                    i++;
                }

                MainWindow.Conferences.Add(new Conference {
                    ID = i, Name = name
                });

                var db = new SQLiteDatabase(MainWindow.CurrentDB);
                db.Insert("Conferences", new Dictionary <string, string> {
                    { "ID", i.ToString() }, { "Name", name }
                });
                lstData.ItemsSource = null;
                lstData.ItemsSource = MainWindow.Conferences;

                var confToEdit = new Conference();
                foreach (Conference item in lstData.Items)
                {
                    if (item.Name == name)
                    {
                        confToEdit = item;
                        break;
                    }
                }

                showEditConferenceWindow(confToEdit);
            }
        }
コード例 #29
0
 private void AdminButton_Click(object sender, RoutedEventArgs e)
 {
     // если мы уже в режиме Администратора, то выходим из него
     if (IsAdminMode)
     {
         IsAdminMode = false;
     }
     else
     {
         // создаем окно для ввода пароля
         var InputBox = new InputBoxWindow("Введите пароль Администратора");
         // и показываем его как диалог (модально)
         if ((bool)InputBox.ShowDialog())
         {
             // если нажали кнопку "Ok", то включаем режим, если пароль введен верно
             IsAdminMode = InputBox.InputText == "0000";
         }
     }
 }
コード例 #30
0
 private void RenameCollectionCommand_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     try
     {
         if (InputBoxWindow.ShowDialog("New name:", "Enter new colletion name", SelectedCollection.Name, out string name) == true)
         {
             SelectedDatabase.RenameCollection(SelectedCollection.Name, name);
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show(
             "Failed to rename collection:" + Environment.NewLine + exc.Message,
             "Database error",
             MessageBoxButton.OK,
             MessageBoxImage.Error
             );
     }
 }