private void OnSalaryItemDeleting(object obj)
        {
            EmployeePaymentDetail detail = ListOfPaymentDetails.CurrentItem as EmployeePaymentDetail;

            if (detail == null)
            {
                return;
            }
            Telerik.Windows.Controls.GridViewDeletingEventArgs e = obj as Telerik.Windows.Controls.GridViewDeletingEventArgs;
            if (e == null)
            {
                return;
            }
            ConfirmationRequest.Raise(new Confirmation()
            {
                Title   = "QauntCo Deutschland GmbH",
                Content = $"Wollen Sie den Eintrag wirklich löschen?"
            }, respone =>
            {
                if (respone.Confirmed)
                {
                    dbAccess.RemoveEmployeePaymentDetail(detail);
                }
                else
                {
                    e.Cancel = true;
                }
            });
        }
        private void OnDeleteProduct(Product product)
        {
            string question = string.Format($"Do you wish to delete\nProduct: {product.ProductName}, with the Id: {product.ProductId}");
            string message  = string.Format($"Product: {product.ProductName}, With the Id: {product.ProductId}, Deleted Successfully, {DateTime.Now}");

            ConfirmationRequest.Raise(
                new Confirmation {
                Title = "Delete Product", Content = question
            },
                (result) => {
                if (result.Confirmed)
                {
                    Products.Remove(product);
                    _eventAggregator.GetEvent <ProductsMessagingEvent>().Publish(message);
                }
                else
                {
                    _eventAggregator.GetEvent <ProductsMessagingEvent>().Publish("Did not Delete");
                }
            }
                );


            #region With StatuBar
            //string message = string.Format($"Product: {product.ProductName}, With the Id: {product.ProductId}, Deleted Successfully, {DateTime.Now}");
            //_eventAggregator.GetEvent<ProductsMessagingEvent>().Publish(message);
            #endregion
        }
Exemplo n.º 3
0
 private void Ok(Window window)
 {
     if (ChangesRequireRestart)
     {
         //Warn if restart required and prompt for Confirmation before restarting
         ConfirmationRequest.Raise(
             new Confirmation
         {
             Title   = "May I restart OptiKey?",
             Content = "OptiKey needs to restart to apply your changes.\nPlease click OK to continue with the restart, or CANCEL to discard your changes"
         }, confirmation =>
         {
             if (confirmation.Confirmed)
             {
                 ApplyChanges();
                 System.Windows.Forms.Application.Restart();
                 Application.Current.Shutdown();
             }
         });
     }
     else
     {
         ApplyChanges();
         window.Close();
     }
 }
Exemplo n.º 4
0
        //削除処理
        private void DeleteExecute()
        {
            ConfirmationRequest.Raise(
                new Confirmation()
            {
                Title   = "確認",
                Content = "削除しますか?"
            },
                r =>
            {
                if (r.Confirmed)
                {
                    if (SQL.DeleteMemo(NaviParam))
                    {
                        NotificationRequest.Raise(new Notification {
                            Content = "削除しました", Title = "成功"
                        });
                        //消す処理
                        Category = null;
                        Title    = "";
                        Detail   = "";

                        _regionManager.Regions["ContentRegion1"].RemoveAll();
                        _regionManager.RequestNavigate("ContentRegion1", "NotesMainView");
                    }
                    else
                    {
                        NotificationRequest.Raise(new Notification {
                            Content = "削除に失敗しました", Title = "失敗"
                        });
                    }
                }
            }
                );
        }
        private void OnDeletingTravelExpense(object obj)
        {
            TravelExpense te = ListOfTravelExpenses.CurrentItem as TravelExpense;

            if (te == null)
            {
                return;
            }
            Telerik.Windows.Controls.GridViewDeletingEventArgs e = obj as Telerik.Windows.Controls.GridViewDeletingEventArgs;
            if (e == null)
            {
                return;
            }
            ConfirmationRequest.Raise(new Confirmation()
            {
                Title   = "QauntCo Deutschland GmbH",
                Content = $"Wollen Sie die ausgewählten Reisekosten ({te.EmployeeName}) wirklich löschen?"
            }, respone =>
            {
                if (respone.Confirmed)
                {
                    dbAccess.RemoveTravelExpense(te);
                }
                else
                {
                    e.Cancel = true;
                }
            });
        }
Exemplo n.º 6
0
 private void Ok(Window window)
 {
     if (ChangesRequireRestart)
     {
         //Warn if restart required and prompt for Confirmation before restarting
         ConfirmationRequest.Raise(
             new Confirmation
         {
             Title   = "May I restart OptiKey?",
             Content = "OptiKey needs to restart to apply your changes.\nPlease click OK to continue with the restart, or CANCEL to discard your changes"
         }, confirmation =>
         {
             if (confirmation.Confirmed)
             {
                 Log.Info("Applying management changes and attempting to restart OptiKey");
                 ApplyChanges();
                 try
                 {
                     System.Windows.Forms.Application.Restart();
                 }
                 catch { }     //Swallow any exceptions (e.g. DispatcherExceptions) - we're shutting down so it doesn't matter.
                 Application.Current.Shutdown();
             }
         });
     }
     else
     {
         Log.Info("Applying management changes");
         ApplyChanges();
         window.Close();
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// executeDelete(DelegateCommand)
        /// </summary>
        private void executeDelete()
        {
            ConfirmationRequest.Raise(new Confirmation {
                Title = "Confirmation", Content = "Are you delete the select item?"
            }, r => ConfirmationRequestResult = r.Confirmed ? "Ok" : "Cancel");

            if (ConfirmationRequestResult != "Ok")
            {
                return;
            }

            Action a = () => {
                HttpResponseMessage response = MainWindowViewModel._httpClient.DeleteAsync("api/Members/" + SelectedItem.MemberID).Result;
                if (!response.IsSuccessStatusCode)
                {
                    throw new HttpRequestException();
                }
                var m = response.Content.ReadAsAsync <Member>().Result;

                this.Items.Remove(this.SelectedItem);
                this.SelectedItem = this.Items[0];
                ItemPropertyChanged();
            };

            ExecuteAction(a);
        }
Exemplo n.º 8
0
        private void Delete()
        {
            ConfirmationRequest.Raise(new Confirmation
            {
                Content = "删除供应商" + CurrentSupplier.Number + "?",
                Title   = "确认"
            },
                                      r =>
            {
                if (r.Confirmed)
                {
                    using (var context = new MasterDataContext())
                    {
                        context.Suppliers.Remove(CurrentSupplier);
                        context.SaveChanges();
                    }

                    IsEdit = false;
                    NotificationRequest.Raise(new Notification {
                        Content = "已删除", Title = "提示"
                    });
                    CurrentSupplier = new Supplier
                    {
                        InternalType = "Supplier",
                        Contacts     = new ObservableCollection <Contact>(),
                    };
                    Title = "供应商新增";
                }
            });
        }
Exemplo n.º 9
0
 void RaiseConfirmation()
 {
     ConfirmationRequest.Raise(new Confirmation {
         Title = "Confirmation", Content = "Confirmation Message"
     }, r =>
                               data = r.Confirmed ? "Confirmed" : "Not Confirmed");
 }
Exemplo n.º 10
0
 private void Ok(Window window)
 {
     if (ChangesRequireRestart)
     {
         //Warn if restart required and prompt for Confirmation before restarting
         ConfirmationRequest.Raise(
             new Confirmation
         {
             Title   = Resources.VERIFY_RESTART,
             Content = Resources.RESTART_MESSAGE
         }, confirmation =>
         {
             if (confirmation.Confirmed)
             {
                 Log.Info("Applying management changes and attempting to restart OptiKey");
                 ApplyChanges();
                 try
                 {
                     System.Windows.Forms.Application.Restart();
                 }
                 catch { }     //Swallow any exceptions (e.g. DispatcherExceptions) - we're shutting down so it doesn't matter.
                 Application.Current.Shutdown();
             }
         });
     }
     else
     {
         Log.Info("Applying management changes");
         ApplyChanges();
         window.Close();
     }
 }
Exemplo n.º 11
0
 private void OnDeleteInvestor()
 {
     ConfirmationRequest.Raise(new Confirmation()
     {
         Title   = ApplicationNames.NotificationTitle,
         Content = $"Möchten Sie den Investor {Investor.InvestorHqTrustAccount} {Investor.IName.FullName} wirklich löschen?"
     }, (OnConfirmationResponse));
 }
 private void OnRemoveFund()
 {
     ConfirmationRequest.Raise(new Confirmation()
     {
         Title   = ApplicationNames.NotificationTitle,
         Content = $"Möchten Sie den Fund {SelectedFund.FundHqTrustNumber} {SelectedFund.FundShortName} wirklich löschen?"
     }, (OnConfirmationResponse));
 }
Exemplo n.º 13
0
 private void ShowConfirmation(string content)
 {
     ConfirmationRequest.Raise(new Confirmation()
     {
         Title   = ApplicationNames.NotificationTitle,
         Content = content + Environment.NewLine + "Möchten Sie es nochmal versuchen?"
     }, OnConfirmFileOpen);
 }
Exemplo n.º 14
0
        private void OnShowConfirmation()
        {
            var confirmation = new YesNoCancelNotification("Really?");

            confirmation.Title = "Really?";

            ConfirmationRequest.Raise(confirmation, c => Response = c.Response.ToString());
        }
Exemplo n.º 15
0
 private void OnDeleteCommitment()
 {
     ConfirmationRequest.Raise(new Confirmation
     {
         Title   = "delete ",
         Content = $"Delete Commitment on {SelectedCommitment.PeFund.FundShortName}"
     }, (OnConfirmDeleteCommitment));
 }
        private void OnShowConfirmation()
        {
            var notification = new Notification();

            notification.Title = "Really?";

            ConfirmationRequest.Raise(notification, n => { });
        }
Exemplo n.º 17
0
 private void OnDeleteCashFlows()
 {
     ConfirmationRequest.Raise(new Confirmation()
     {
         Title   = ApplicationNames.NotificationTitle,
         Content = "Sollen die ausgewählten Cashflows wirklich gelöscht werden?"
     }, OnDeleteCashFlowConfirmation);
 }
Exemplo n.º 18
0
        private void Delete()
        {
            var supplier = SuppliersView.CurrentItem as Supplier;

            ConfirmationRequest.Raise(
                new Confirmation
            {
                Content = "删除供应商" + supplier.Name + "?",
                Title   = "确认",
            },
                r =>
            {
                if (r.Confirmed)
                {
                    using (var context = new MasterDataContext())
                    {
                        var existingSupplier = context.Suppliers.Where(s => s.Id == supplier.Id)
                                               .Include(s => s.Contacts).FirstOrDefault();
                        if (existingSupplier == null)
                        {
                            NotificationRequest.Raise(
                                new Notification
                            {
                                Content = "供应商" + supplier.Name + "不存在。\n可能已删除,请重新查询。",
                                Title   = "提示"
                            }
                                );
                            return;
                        }
                        context.Remove(existingSupplier);
                        context.SaveChanges();
                    }

                    NotificationRequest.Raise(
                        new Notification
                    {
                        Content = "已删除。",
                        Title   = "提示"
                    }
                        );
                    Suppliers.Remove(supplier);
                    SuppliersView.Refresh();
                    TotalRecords -= 1;
                    TotalPages    = (int)Math.Ceiling(1.0 * TotalRecords / PageSize);

                    if (TotalPages == 0)
                    {
                        PageIndex = 0;
                    }
                    else if (PageIndex > TotalPages)
                    {
                        PageIndex     = TotalPages;
                        SuppliersView = CollectionViewSource.GetDefaultView(Suppliers.Skip((PageIndex - 1) * PageSize).Take(PageSize));
                    }
                }
            }
                );
        }
Exemplo n.º 19
0
        private bool confirmation <T>(T _)
        {
            bool ret = false;

            ConfirmationRequest.Raise(new Confirmation {
                Title = "確認", Content = "何もしないですけど良いですか?", Confirmed = false
            }, c => ret = c.Confirmed);
            return(ret);
        }
Exemplo n.º 20
0
 private void ShowConfirmation()
 {
     ConfirmationRequest.Raise(new Confirmation()
     {
         Title = "Confirmation", Content = "This is an example of confirmation"
     }, r =>
     {
         Status = r.Confirmed ? "Confirmation raised" : "Cancellation raised";
     });
 }
Exemplo n.º 21
0
        private MsgBoxResult RaiseConfirmation(string title, string confirmationMessage)
        {
            var j = MsgBoxResult.None;

            ConfirmationRequest.Raise(
                new Confirmation {
                Content = title, Title = confirmationMessage
            },
                c => { j = c.Confirmed ? MsgBoxResult.OK : MsgBoxResult.Cancel; });
            return(j);
        }
        private void OnShowConfirmation()
        {
            var confirmation = new Confirmation();

            confirmation.Title = "Really?";

            // TODO: unfort. i couldnt find a way to provide a DataTemplate for ConfirmationContent to the new window
            confirmation.Content = new ConfirmationContent("Here goes the question, doesn't it?");

            ConfirmationRequest.Raise(confirmation, c => Response = c.Confirmed ? "yes" : "no");
        }
        private void OnShowConfirmation()
        {
            var notification = new Notification();

            notification.Title = "Really?";

            // trigger region creation and view injection
            RegionManager.UpdateRegions();

            ConfirmationRequest.Raise(notification, n => { });
        }
Exemplo n.º 24
0
        //public ICollectionView ItemsCV { get; private set; }
        // // Initialize the CollectionView for the underlying model
        // // and track the current selection.
        //this.ItemsCV = CollectionViewSource.GetDefaultView(ToDoItemList);


        //public void SaveToDoItem()
        //(
        //    //SelectedItem
        //    //_ToDoItemListService.SaveToDoItem();
        //)

        void RaiseConfirmation()
        {
            //  string Title = "";

            ConfirmationRequest.Raise(new Confirmation
            {
                Title   = "Confirmation",
                Content = "Confirmation Message"
            },
                                      r => confirmed = r.Confirmed ? true : false);
            //r => Title = r.Confirmed ? "Confirmed" : "Not Confirmed");
        }
        private void OnShowConfirmation()
        {
            var notification = new Notification();

            notification.Title = "Really?";

            // we create ViewModel with new here for simplicity. Of course we could also import it into e.g. private field
            // in order to let MEF resolve all dependencies
            notification.Content = new ComplexDialogModel(Model);

            ConfirmationRequest.Raise(notification, n => { });
        }
Exemplo n.º 26
0
        private void CoercePersianSettings()
        {
            if (WordsViewModel.KeyboardAndDictionaryLanguage == Languages.PersianIran &&
                WordsViewModel.UiLanguage != Languages.PersianIran)
            {
                ConfirmationRequest.Raise(
                    new Confirmation
                {
                    Title   = Resources.UILANGUAGE_AND_KEYBOARDANDDICTIONARYLANGUAGE_DIFFER_TITLE,
                    Content = Resources.DEFAULT_UILANGUAGE_TO_PERSIAN
                }, confirmation =>
                {
                    if (confirmation.Confirmed)
                    {
                        Log.Info("Prompting user to change the UiLanguage to Persian as the KeyboardAndDictionaryLanguage is Persian. The UiLanguage controls whether the scratchpad has text flow RightToLeft, which Persian requires.");
                        WordsViewModel.UiLanguage = Languages.PersianIran;
                    }
                });
            }

            if ((WordsViewModel.KeyboardAndDictionaryLanguage == Languages.PersianIran ||
                 WordsViewModel.UiLanguage == Languages.PersianIran) &&
                !new[]
            {
                VisualsViewModel.ElhamUrl,
                VisualsViewModel.HomaUrl,
                VisualsViewModel.KoodakUrl,
                VisualsViewModel.NazliUrl,
                VisualsViewModel.RoyaUrl,
                VisualsViewModel.TerafikUrl,
                VisualsViewModel.TitrUrl
            }.Contains(VisualsViewModel.FontFamily))
            {
                ConfirmationRequest.Raise(
                    new Confirmation
                {
                    Title   = Resources.LANGUAGE_SPECIFIC_FONT_RECOMMENDED,
                    Content = Resources.FONTFAMILY_IS_NOT_COMPATIBLE_WITH_PERSIAN_LANGUAGE
                }, confirmation =>
                {
                    if (confirmation.Confirmed)
                    {
                        Log.Info("Prompting user to change the font to an Persian compatible font. If another font is used then text may be displayed incorrectly.");
                        VisualsViewModel.FontFamily  = VisualsViewModel.NazliUrl;
                        VisualsViewModel.FontStretch = Enums.FontStretches.Normal;
                        VisualsViewModel.FontWeight  = Enums.FontWeights.Regular;
                    }
                });
            }
        }
Exemplo n.º 27
0
 private void Cancel(Window window)
 {
     //Warn if wants to discard all the changes
     ConfirmationRequest.Raise(
         new Confirmation
     {
         Title   = Resources.SETTINGS_CHANGED,
         Content = Resources.DISCARD_CHANGED_SETTINGS
     }, confirmation =>
     {
         if (confirmation.Confirmed)
         {
             window.Close();
         }
     });
 }
Exemplo n.º 28
0
 public void ConfirmNavigationRequest(NavigationContext navigationContext, Action <bool> continuationCallback)
 {
     if (navigationContext.Uri == null)
     {
         ConfirmationRequest.Raise(
             new Confirmation {
             Content = "Закрыть без сохранения?", Title = "Закрытие вкладки"
         },
             c => {
             continuationCallback(c.Confirmed);
         });
     }
     else
     {
         continuationCallback(true);
     }
 }
Exemplo n.º 29
0
        private void CoerceUrduSettings()
        {
            if (WordsViewModel.KeyboardAndDictionaryLanguage == Languages.UrduPakistan &&
                WordsViewModel.UiLanguage != Languages.UrduPakistan)
            {
                ConfirmationRequest.Raise(
                    new Confirmation
                {
                    Title   = Resources.UILANGUAGE_AND_KEYBOARDANDDICTIONARYLANGUAGE_DIFFER_TITLE,
                    Content = Resources.DEFAULT_UILANGUAGE_TO_URDU
                }, confirmation =>
                {
                    if (confirmation.Confirmed)
                    {
                        Log.Info("Prompting user to change the UiLanguage to Urdu as the KeyboardAndDictionaryLanguage is Urdu. The UiLanguage controls whether the scratchpad has text flow RightToLeft, which Urdu requires.");
                        WordsViewModel.UiLanguage = Languages.UrduPakistan;
                    }
                });
            }

            if ((WordsViewModel.KeyboardAndDictionaryLanguage == Languages.UrduPakistan ||
                 WordsViewModel.UiLanguage == Languages.UrduPakistan) &&
                !new[]
            {
                VisualsViewModel.FajerNooriNastaliqueUrl,
                VisualsViewModel.NafeesWebNaskhUrl,
                VisualsViewModel.PakNastaleeqUrl
            }.Contains(VisualsViewModel.FontFamily))
            {
                ConfirmationRequest.Raise(
                    new Confirmation
                {
                    Title   = Resources.LANGUAGE_SPECIFIC_FONT_RECOMMENDED,
                    Content = Resources.FONTFAMILY_IS_NOT_COMPATIBLE_WITH_URDU_LANGUAGE
                }, confirmation =>
                {
                    if (confirmation.Confirmed)
                    {
                        Log.Info("Prompting user to change the font to an Urdu compatible font. If another font is used then text (especially numbers which are only displayed correctly in Urdu if an Urdu font is used) may be displayed incorrectly.");
                        VisualsViewModel.FontFamily  = VisualsViewModel.NafeesWebNaskhUrl;
                        VisualsViewModel.FontStretch = Enums.FontStretches.Normal;
                        VisualsViewModel.FontWeight  = Enums.FontWeights.Regular;
                    }
                });
            }
        }
Exemplo n.º 30
0
        private void RaiseSupplierContactDelete(object args)
        {
            var button      = (args as RoutedEventArgs).OriginalSource as Button;
            var listboxItem = VisualTreeHelperExtensions.FindAncestor <ListBoxItem>(button);
            var contact     = listboxItem.DataContext as Contact;

            ConfirmationRequest.Raise(new Confirmation
            {
                Title   = "确认",
                Content = "删除联系人" + contact.Name + "?",
            }, r =>
            {
                if (r.Confirmed)
                {
                    CurrentSupplier.Contacts.Remove(contact);
                }
            });
        }