Пример #1
0
        private void deleteButton_Click(object sender, RoutedEventArgs e)
        {
            if (rental_HistoryDataGrid.SelectedItem == null)
            {
                return;
            }

            String confirmMessage = "Are you sure you want to delete this rental entry?";

            if (rental_HistoryDataGrid.SelectedItems != null && rental_HistoryDataGrid.SelectedItems.Count > 1)
            {
                confirmMessage = "Are you sure you want to delete these " + rental_HistoryDataGrid.SelectedItems.Count + " rental entries?";
            }

            deleteConfirmation = new ConfirmationDialog("Delete Rental Confirmation", confirmMessage);

            deleteConfirmation.ShowDialog();

            if (!deleteConfirmation.YesClicked)
            {
                return;
            }

            deleteRentalsHelper(rental_HistoryDataGrid.SelectedItems);
            updateDataGrid();
        }
        private void BtnRemoveVariation_Click(object sender, EventArgs e)
        {
            ConfirmationDialog removeConfirmation = new ConfirmationDialog(REMOVE_VARIATION_TITLE, REMOVE_VARIATION_TEXT);

            if (removeConfirmation.ShowDialog() == DialogResult.Yes)
            {
                presenter.RemoveVariation(LbxVariation.SelectedIndex);
            }
        }
Пример #3
0
        /// <summary>
        /// Confirms that file should be closed</summary>
        /// <param name="message">Confirmation message</param>
        /// <returns>Dialog result</returns>
        public FileDialogResult ConfirmFileClose(string message)
        {
            ConfirmationDialog dialog = new ConfirmationDialog("Close".Localize("Close file"), message);

            dialog.YesButtonText = "&Save".Localize("The '&' is optional and means that Alt+S is the keyboard shortcut on this button");
            dialog.NoButtonText  = "&Discard".Localize("The '&' is optional and means that Alt+D is the keyboard shortcut on this button");
            DialogResult result = dialog.ShowDialog(GetDialogOwner());

            dialog.Dispose();
            return(DialogResultToFileDialogResult(result));
        }
        public DialogResult ShowConfirmationDialog(Project oldProject, Project newProject)
        {
            ConfirmationDialog confirmationDialog = new ConfirmationDialog(oldProject, newProject);
            DialogResult dialogResult;

            using (confirmationDialog)
            {
                dialogResult = confirmationDialog.ShowDialog();
            }

            return dialogResult;
        }
Пример #5
0
        public DialogResult ShowConfirmationDialog(Project oldProject, Project newProject)
        {
            ConfirmationDialog confirmationDialog = new ConfirmationDialog(oldProject, newProject);
            DialogResult       dialogResult;

            using (confirmationDialog)
            {
                dialogResult = confirmationDialog.ShowDialog();
            }

            return(dialogResult);
        }
Пример #6
0
    protected void OnPointerClick(PointerEventData eventData)
    {
        if (Mode != PVMode.Delete)
        {
            return;
        }

        var touchPosition = eventData.pressPosition;
        var ray           = Camera.main.ScreenPointToRay(touchPosition);

        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            if (hit.transform.gameObject != null)
            {
                GameObject touchedObject = hit.transform.gameObject;
                Debug.Log("MobilePhysicalVisualizerManager::OnPointerClick - Touched " + touchedObject.transform.name);

                var selectable = touchedObject.GetComponent <SelectableSensor>();

                if (selectable == null)
                {
                    Debug.Log("MobilePhysicalVisualizerManager::OnPointerClick - Selectable sensor not found" + touchedObject.transform.name);
                    return;
                }

                selectable.IsSelected = true;

                StartCoroutine(UpdateSelectionStates(touchedObject));

                SelectedAnchor = touchedObject;

                string message = "Are you sure you want to delete this anchor?";

                ConfirmationDialog.ShowDialog(ConfirmationDialogPrefab, DialogParent, message, (result) =>
                {
                    Debug.Log(string.Format("Delete dialog closed, result: {0}", result));

                    if (result && SelectedAnchor != null)
                    {
                        ShowLoadingIndicator("Deleting anchor...");

                        var panel       = SelectedAnchor.GetComponent <ProximityVisibility>().Object;
                        var cloudAnchor = SelectedAnchor.GetComponent <AnchorBinding>().Anchor;

                        _anchorManager.DeleteAnchor(SelectedAnchor, panel, cloudAnchor);
                    }
                });
            }
        }
    }
Пример #7
0
        private void DefaultsButton_Click(object sender, EventArgs e)
        {
            ConfirmationDialog dialog =
                new ConfirmationDialog(
                    "Reset All Preferences".Localize("Reset all preferences to their default values?"),
                    "Reset all preferences to their default values?".Localize());
            DialogResult result = dialog.ShowDialog(m_dialogOwner);

            if (result == DialogResult.Yes)
            {
                m_settingsService.SetDefaults();
                m_propertyGrid.Refresh();
            }
        }
Пример #8
0
        private void BtnGenerate_Click(object sender, EventArgs e)
        {
            if (ViewState == ViewState.IsRefreshing)
            {
                return;
            }
            if (!IdInternDetails.presenter.savedChanges)
            {
                ConfirmationDialog saveNotification = new ConfirmationDialog(SAVE_NOTIFICATION_TITLE, SAVE_NOTIFICATION_TEXT);
                if (saveNotification.ShowDialog() == DialogResult.Yes)
                {
                    speichernToolStripMenuItem_Click(sender, e);
                }
            }
            Dictionary <string, string> textParts = new Dictionary <string, string>();

            for (int i = 0; i < textPartSelectionList.Count; i++)
            {
                foreach (CriteriaTextSelectionV singleTextPartSelection in textPartSelectionList)
                {
                    if (i == singleTextPartSelection.Position)
                    {
                        if (singleTextPartSelection.presenter.SelectedVariation != null)
                        {
                            textParts[singleTextPartSelection.presenter.CurShowedCriteria.Name] = singleTextPartSelection.presenter.SelectedVariation.PredifinedText;
                        }
                        else
                        {
                            textParts[singleTextPartSelection.presenter.CurShowedCriteria.Name] = "";
                        }
                    }
                }
            }
            try
            {
                Presenter.GenerateWordDocument(IdInternDetails.presenter.CurShowedInternDetails, textParts, IdInternDetails.BulletpointsPractExp, IdInternDetails.BulletpointsExcercises);
            }
            catch (FileNotFoundException)
            {
                OpenMessageDialog(FILE_NOT_FOUND_TITLE, DEFAULT_TEMPLATE_NOT_FOUND_TEXT);
            }
            catch (IOException)
            {
                OpenMessageDialog(IOEXCEPTION_DIALOG_TITLE, IOEXCEPTION_DIALOG_TEXT);
            }
            catch (Exception ex) when(ex is DirectoryNotFoundException || ex is PathTooLongException)
            {
                OpenMessageDialog(INVALID_PATH_TITLE, INVALID_PATH_TEXT);
            }
        }
        private void BtnRemoveCriteria_Click(object sender, EventArgs e)
        {
            if (viewState == ViewState.IsRefreshing)
            {
                return;
            }

            ConfirmationDialog confirmation = new ConfirmationDialog(KRITERIUM_LOESCHEN_TITLE, KRITERIUM_LOESCHEN_MESSAGE);

            if (confirmation.ShowDialog() == DialogResult.Yes)
            {
                presenter.RemoveCriteria(LbxCriteria.SelectedIndex);
            }
        }
Пример #10
0
 private void TransferProgressDialogOnClosing(object sender, CancelEventArgs e)
 {
     e.Cancel = true;
     if (_isAbortionInProgress) return;
     var vm = ((TransferProgressDialog) sender).ViewModel;
     if (!vm.IsResumeSupported)
     {
         _abortDialog = new ConfirmationDialog(Resources.Warning, Resources.ResumeIsNotAvailableConfirmation);
         var res = _abortDialog.ShowDialog();
         _abortDialog = null;
         if (res != true) return;
     }
     _transferProgressDialog.Abort.IsEnabled = false;
     _isAbortionInProgress = true;
     _transferProgressDialog.ViewModel.AbortTransfer();
 }
Пример #11
0
 private void BtnNew_Click(object sender, EventArgs e)
 {
     if (!IdInternDetails.presenter.savedChanges)
     {
         ConfirmationDialog saving = new ConfirmationDialog(CREATE_NEW_DOC_TITLE, CREATE_NEW_DOC_TEXT);
         if (saving.ShowDialog() == DialogResult.Yes)
         {
             if (IdInternDetails.LoadedDataPath != "")
             {
                 IdInternDetails.SaveDetailsAs();
             }
             else
             {
                 IdInternDetails.SaveDetails();
             }
         }
     }
     IdInternDetails.CleanUI();
     RefreshView();
 }
Пример #12
0
        /// <summary>
        /// Invokes the action.
        /// </summary>
        /// <param name="parameter">The parameter to the action. If the action does not require a parameter, the parameter may be set to a null reference.</param>
        protected override void Invoke(object parameter)
        {
            InteractionRequestedEventArgs args = parameter as InteractionRequestedEventArgs;

            if (args != null)
            {
                ViewModels.MainWindowViewModel.ConfirmationWrapper confirmation = args.Context as ViewModels.MainWindowViewModel.ConfirmationWrapper;
                if (confirmation != null)
                {
                    ConfirmationDialog window       = new ConfirmationDialog(confirmation);
                    EventHandler       closeHandler = null;
                    closeHandler = (sender, e) =>
                    {
                        window.Closed -= closeHandler;
                        args.Callback();
                    };
                    window.Closed += closeHandler;
                    window.ShowDialog();
                }
            }
        }
Пример #13
0
        public void DeleteAction(object item)
        {
            ConfirmationDialog confirmation = new ConfirmationDialog()
            {
                FlowDirection   = FlowDirection.RightToLeft,
                DataContext     = new ConfirmationDialogViewModel("Confirmation"),
                Background      = (SolidColorBrush)(new BrushConverter().ConvertFrom("#BF4545")),
                Foreground      = Brushes.GhostWhite,
                BorderBrush     = (SolidColorBrush)(new BrushConverter().ConvertFrom("#99BF4545")),
                BorderThickness = new Thickness(5)
            };

            confirmation.ShowDialog();
            if (confirmation.DialogResult == true)
            {
                db.Watchers.Remove(SelectedItem.Model);
                ItemsList.Remove(SelectedItem);
                db.SaveChanges();
                SelectedItem = null;
            }
        }
Пример #14
0
        /// <summary>
        /// Promotes objects to template library.
        /// Items can be promoted when the active context is CircuitEditingContext and all the items are selected modules.</summary>
        /// <param name="items">Items to promote</param>
        public override void PromoteToTemplateLibrary(IEnumerable <object> items)
        {
            var itemsArray = items.ToArray();


            // cache the external connections
            var externalConnectionsDict = new Dictionary <Element, List <Wire> >();
            var circuitEditingContext   = ContextRegistry.GetActiveContext <CircuitEditingContext>();
            var graphContainer          = circuitEditingContext.CircuitContainer;

            foreach (var item in itemsArray)
            {
                var modules             = new HashSet <Element>();
                var internalConnections = new List <Wire>();
                var externalConnections = new List <Wire>();
                CircuitUtil.GetSubGraph(graphContainer, new[] { item }, modules, internalConnections, externalConnections, externalConnections);
                externalConnectionsDict.Add(item.Cast <Element>(), externalConnections);
            }

            // check source guid for templates to be replaced
            var templatingItems = new List <object>();
            var replacingItems  = new List <object>();

            foreach (var item in itemsArray)
            {
                if (item.Is <Module>())
                {
                    var module = item.Cast <Module>();
                    if (module.SourceGuid != Guid.Empty)
                    {
                        var existingTemplate = TemplatingContext.SearchForTemplateByGuid(TemplatingContext.RootFolder, module.SourceGuid);
                        if (existingTemplate != null)
                        {
                            string message = string.Format(
                                "Overwrite the existing \"{0}\"  Template with \"{1}\", or Add new one?\n".Localize(),
                                existingTemplate.Name, module.Name);

                            var dialog = new ConfirmationDialog("Overwrite / Add".Localize(), message);
                            dialog.YesButtonText = "Overwrite".Localize();
                            dialog.NoButtonText  = "Add".Localize();
                            dialog.Size          = new System.Drawing.Size(300, 100);
                            DialogResult result = dialog.ShowDialog();
                            if (result == DialogResult.Yes)
                            {
                                TemplatingContext.ReplaceTemplateModel(existingTemplate, module.Cast <DomNode>());
                                replacingItems.Add(item);
                            }
                            else if (result == DialogResult.No)
                            {
                                templatingItems.Add(item);
                            }
                            //otherwise the item is skipped
                        }
                    }
                    else
                    {
                        templatingItems.Add(item);
                    }
                }
            }

            // pack objects in IDataObject format
            var dataObject = new DataObject();

            dataObject.SetData(typeof(object[]), templatingItems.ToArray());

            // Insert() expects IDataObject
            TemplatingContext.Insert(dataObject);

            // replace the original items with the template instances
            foreach (var originalItem in templatingItems.Concat(replacingItems))
            {
                var template = TemplatingContext.LastPromoted(originalItem);
                var instance = TemplatingContext.CreateReference(template);

                var originalModule = originalItem.Cast <Element>();
                var replacedModule = instance.Cast <Element>();
                replacedModule.Bounds   = originalModule.Bounds;
                replacedModule.Position = originalModule.Position;

                // reroute external connections from original modules to replaced template instances.
                var externalConnections = externalConnectionsDict[originalModule];
                foreach (var connection in externalConnections)
                {
                    if (connection.InputElement.DomNode == originalModule.DomNode)
                    {
                        // input pin, i.e. pin on element that receives connection as input
                        int pinIndex = connection.InputPin.Index;
                        connection.InputPin       = replacedModule.Type.Inputs[pinIndex];
                        connection.InputElement   = replacedModule;
                        connection.InputPinTarget = null;                                // reset
                    }
                    else if (connection.OutputElement.DomNode == originalModule.DomNode) //output pin, i.e., pin on element that receives connection as output
                    {
                        connection.OutputPin       = replacedModule.Type.Outputs[connection.OutputPin.Index];
                        connection.OutputElement   = replacedModule;
                        connection.OutputPinTarget = null;
                    }
                    else
                    {
                        Debug.Assert(false);
                    }
                }
                circuitEditingContext.CircuitContainer.Elements.Remove(originalItem.Cast <Element>());
                circuitEditingContext.CircuitContainer.Elements.Add(replacedModule);
            }
        }
Пример #15
0
 /// <summary>
 /// Promts a confirmation dialog with two buttons options
 /// </summary>
 /// <param name="dataContext">DataContext of the dialog</param>
 /// <returns>The result of the confirmation</returns>
 protected virtual bool ShowConfirmationDialogInternal(IConfirmationDialogViewModel dataContext)
 {
     ConfirmationDialog dlg = new ConfirmationDialog
     {
         DataContext = dataContext,
         Owner =
                 Application.Current.MainWindow != null && Application.Current.MainWindow.IsActive
                     ? Application.Current.MainWindow
                     : null
     };
     return dlg.ShowDialog() == true;
 }
Пример #16
0
        public static bool ConfirmationDialog(string message)
        {
            ConfirmationDialog cd = new ConfirmationDialog(message);

            return(cd.ShowDialog() == true);
        }