public void Execute()
        {
            BackgroundModel background = backgroundCollection.Get(args.Value);

            string parentProfileNames = GetParentProfileNames(background);

            if (parentProfileNames != null)
            {
                MessageBoxView.Show("Can't delete this background", $"This background is used by one or more profiles ({parentProfileNames}), you can't delete it.");
                return;
            }

            backgroundCollection.Remove(background);

            if (screenModel.Background == background)
            {
                // Default background can't be deleted so there's always at least 1 item in the list.
                screenModel.SetBackground(backgroundCollection.Items[0]);
            }

            database.DeleteBackground(background);

            string dirPath = locationModel.GetGraphicBasePath(background.DirectoryType);

            File.Delete(Path.Combine(dirPath, background.FileName));
        }
Exemplo n.º 2
0
        private void _ShowMessage()
        {
            var vm = new MessageBoxViewModel
            {
                Title            = MessageBoxData.Title,
                Message          = MessageBoxData.Message,
                Icon             = MessageBoxData.Icon,
                ShowConfirm      = MessageBoxData.ShowConfirm,
                ConfirmText      = MessageBoxData.ConfirmText,
                ShowDecline      = MessageBoxData.ShowDecline,
                DeclineText      = MessageBoxData.DeclineText,
                ShowCancel       = MessageBoxData.ShowCancel,
                CancelText       = MessageBoxData.CancelText,
                DefaultAction    = MessageBoxData.DefaultAction,
                AllowNonResponse = MessageBoxData.AllowNonResponse
            };

            var view = new MessageBoxView
            {
                DataContext           = vm,
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
                Owner = this
            };

            view.ShowDialog();
        }
Exemplo n.º 3
0
        public void OnShowNotifMsgUI(object sender, NotifMsg e)
        {
            MessageBoxView view = WorkItem.SmartParts.Contains(e.Id) ?
                                  WorkItem.SmartParts.Get <MessageBoxView>(e.Id) :
                                  WorkItem.SmartParts.AddNew <MessageBoxView>(e.Id);

            view.Message = e;

            if (!_StateManager.ScreenSaver.On)
            {
                WindowSmartPartInfo info = new WindowSmartPartInfo();

                info.ControlBox  = false;
                info.MaximizeBox = false;
                info.MinimizeBox = false;
                info.Title       = view.Message.Caption;
                info.Keys[WindowWorkspaceSetting.FormBorderStyle] = FormBorderStyle.Sizable;
                view.Width    = view.Message.Width;
                view.Height   = view.Message.Height;
                info.Location = new Point((Screen.PrimaryScreen.Bounds.Width - view.Width) / 2, (Screen.PrimaryScreen.Bounds.Height - view.Height) / 2);

                WorkItem.Workspaces[WorkspaceNames.ModalWindows].Show(view, info);
            }
            else if (!_Messages.Contains(view))
            {
                _Messages.Add(view);
            }
        }
Exemplo n.º 4
0
        public async Task <MessageBoxResult> MessageBox(string title, string message)
        {
            var v  = new MessageBoxView();
            var vm = _factory.Create <MessageBoxViewModel>();

            v.DataContext = vm;
            return((MessageBoxResult)await DialogHost.Show(v));
        }
Exemplo n.º 5
0
 public void HideWarn()
 {
     if (m_MessageBoxView != null)
     {
         GameObject.DestroyObject(m_MessageBoxView.gameObject);
         m_MessageBoxView = null;
     }
 }
Exemplo n.º 6
0
        private static Task <DialogResult> ShowCore(Window owner, string text, string caption, MessageBoxButtons buttons,
                                                    MessageBoxIcon icon,
                                                    MessageBoxDefaultButton defaultButton,
                                                    MessageBoxOptions options)
        {
            MessageBoxView window = new MessageBoxView(owner, options);

            window.DataContext = new MessageBoxViewModel(text, caption, buttons, window.GetIconDrawing(icon), defaultButton, options);
            return(owner != null?window.ShowDialog(owner) : window.Show());
        }
        public async Task <T?> ShowDialog <T>(IMessageBox <T> messageBox)
        {
            MessageBoxView view      = new MessageBoxView();
            var            viewModel = new MessageBoxViewModel <T>(messageBox);

            view.DataContext = viewModel;
            await view.ShowDialog <bool>(mainWindowHolder.Window);

            return(viewModel.SelectedOption);
        }
Exemplo n.º 8
0
        public static MessageBoxResult Show(Window parentWindow, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options)
        {
            MessageBoxViewModel viewModel = new MessageBoxViewModel(messageBoxText, caption, button, icon, defaultResult, options);
            MessageBoxView      view      = new MessageBoxView();

            view.DataContext = viewModel;
            view.Owner       = parentWindow;
            view.ShowDialog();

            return(viewModel.Result);
        }
 protected override void OnViewLoaded(object view)
 {
     View = view as MessageBoxView;
     if (failAndRetry == FailAndRetry.FaceIdentificationFail)
     {
         View.Fail1.Visibility = System.Windows.Visibility.Visible;
     }
     else if (failAndRetry == FailAndRetry.FaceIdentificationFail3 || failAndRetry == FailAndRetry.InformationInputFail3)
     {
         View.Fail2.Visibility = System.Windows.Visibility.Visible;
     }
     else if (failAndRetry == FailAndRetry.InformationInputFail)
     {
         View.Fail3.Visibility = System.Windows.Visibility.Visible;
     }
 }
Exemplo n.º 10
0
        public MessageBoxResult ShowMessageBox(string text, string title, MessageBoxButton buttons, MessageBoxImage icon = MessageBoxImage.Asterisk, MessageBoxResult defaultResult = MessageBoxResult.None)
        {
            var vm = new MessageBoxViewModel(text, title, buttons, icon, defaultResult);

            var owner = _viewProvider.View;
            var popup = new MessageBoxView
            {
                Owner       = owner,
                DataContext = vm
            };

            _blur.Blur();
            popup.ShowDialog();
            _blur.UnBlur();

            return(vm.Result);
        }
Exemplo n.º 11
0
		/// <summary>
		/// Display a MessageBox
		/// </summary>
		/// <param name="messageBoxText">A System.String that specifies the text to display.</param>
		/// <param name="caption">A System.String that specifies the title bar caption to display.</param>
		/// <param name="buttons">A System.Windows.MessageBoxButton value that specifies which button or buttons to display.</param>
		/// <param name="icon">A System.Windows.MessageBoxImage value that specifies the icon to display.</param>
		/// <param name="defaultResult">A System.Windows.MessageBoxResult value that specifies the default result of the message box.</param>
		/// <param name="cancelResult">A System.Windows.MessageBoxResult value that specifies the cancel result of the message box</param>
		/// <param name="options">A System.Windows.MessageBoxOptions value object that specifies the options.</param>
		/// <param name="buttonLabels">A dictionary specifying the button labels, if desirable</param>
		/// <returns>The result chosen by the user</returns>
		public MessageBoxResult ShowMessageBox(string messageBoxText, string caption = "",
				MessageBoxButton buttons = MessageBoxButton.OK,
				MessageBoxImage icon = MessageBoxImage.None,
				MessageBoxResult defaultResult = MessageBoxResult.None,
				MessageBoxResult cancelResult = MessageBoxResult.None,
				MessageBoxOptions options = MessageBoxOptions.None,
				IDictionary<MessageBoxResult, string> buttonLabels = null)
		{
			var vm = messageBoxViewModelFactory();
			vm.Setup(messageBoxText, caption, buttons, icon, defaultResult, cancelResult, options, buttonLabels);
			// Don't go through the IoC container to get the View. This means we can simplify it...
			var messageBoxView = new MessageBoxView();
			messageBoxView.InitializeComponent();
			viewManager.BindViewToModel(messageBoxView, vm);
			ShowDialog(vm);
			return vm.ClickedButton;
		}
Exemplo n.º 12
0
        /// <summary>
        /// Display a MessageBox
        /// </summary>
        /// <param name="messageBoxText">A System.String that specifies the text to display.</param>
        /// <param name="caption">A System.String that specifies the title bar caption to display.</param>
        /// <param name="buttons">A System.Windows.MessageBoxButton value that specifies which button or buttons to display.</param>
        /// <param name="icon">A System.Windows.MessageBoxImage value that specifies the icon to display.</param>
        /// <param name="defaultResult">A System.Windows.MessageBoxResult value that specifies the default result of the message box.</param>
        /// <param name="cancelResult">A System.Windows.MessageBoxResult value that specifies the cancel result of the message box</param>
        /// <param name="options">A System.Windows.MessageBoxOptions value object that specifies the options.</param>
        /// <param name="buttonLabels">A dictionary specifying the button labels, if desirable</param>
        /// <returns>The result chosen by the user</returns>
        public MessageBoxResult ShowMessageBox(string messageBoxText, string caption = "",
                                               MessageBoxButton buttons       = MessageBoxButton.OK,
                                               MessageBoxImage icon           = MessageBoxImage.None,
                                               MessageBoxResult defaultResult = MessageBoxResult.None,
                                               MessageBoxResult cancelResult  = MessageBoxResult.None,
                                               MessageBoxOptions options      = MessageBoxOptions.None,
                                               IDictionary <MessageBoxResult, string> buttonLabels = null)
        {
            var vm = this.messageBoxViewModelFactory();

            vm.Setup(messageBoxText, caption, buttons, icon, defaultResult, cancelResult, options, buttonLabels);
            // Don't go through the IoC container to get the View. This means we can simplify it...
            var messageBoxView = new MessageBoxView();

            messageBoxView.InitializeComponent();
            this.viewManager.BindViewToModel(messageBoxView, vm);
            this.ShowDialog(vm);
            return(vm.ClickedButton);
        }
Exemplo n.º 13
0
    public void ShowWarn(int iTitle, string strMsg, System.Action callback)
    {
        string sTitle = LanguageMgr.GetString(iTitle);

        Debug.LogError(strMsg);
        if (m_MessageBoxView == null)
        {
            System.Action <Object> handler = (asset) => {
                if (asset != null)
                {
                    GameObject objMsgBox = (GameObject)GameObject.Instantiate(asset);                      // 创建弹窗 显示
                    m_MessageBoxView = objMsgBox.GetComponent <MessageBoxView>();
                    NGUIUtility.SetParent(waitingParentT, objMsgBox.transform);
                    m_MessageBoxView.show(sTitle, strMsg, callback);
                }
            };

            StartCoroutine(BundleMgr.CreateObject(kResource.View, "MessageBoxView", "MessageBoxView", handler));
        }
    }
Exemplo n.º 14
0
        /// <summary>
        /// Load event for MainFormView.
        /// </summary>
        /// <param name="sender">Object with send this event.</param>
        /// <param name="e">Event object.</param>
        private void MainFormView_Load(object sender, EventArgs e)
        {
            presenter = Bootstrapper.ServiceLocator.GetService <IMainFormViewPresenter>();

            Settings.Click += (x, y) =>
            {
                using (
                    SettingsView view = new SettingsView())
                {
                    view.ShowDialog();
                }
            };

            ShowInstruction.Click += (x, y) =>
            {
                Presenter.OpenInstruction();
            };

            About.Click += (x, y) =>
            {
                using (
                    AboutView view = new AboutView())
                {
                    view.ShowDialog();
                }
            };

            Close.Click += (x, y) =>
            {
                if (MessageBoxView.Show("Zamknąć aplikację? Wszystkie wykonane obliczenia zostaną utracone.", "Zamknij",
                                        MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    this.Close();
                }
            };

            SetDefaulfAlgorithm();
            SetStartupValues();
            SetStartupControlsState();
            SetWeightsDataSource(null);
        }
        private static void OpenMessageWindow(StudioViewsFilesSplitViewModel model)
        {
            var messageInfo = new MessageInfo
            {
                Title       = PluginResources.Message_Title_Task_Result,
                Message     = model.Message,
                LogFilePath = model.LogFilePath,
                Folder      = model.ExportPath,
                ShowImage   = true,
                ImageUrl    = model.Success
                                        ? "/Sdl.Community.StudioViews;component/Resources/information.png"
                                        : "/Sdl.Community.StudioViews;component/Resources/warning.png"
            };

            var messageView      = new MessageBoxView();
            var messageViewModel = new MessageBoxViewModel(messageView, messageInfo);

            messageView.DataContext = messageViewModel;

            messageView.ShowDialog();
        }
        public static MessageBoxViewModel Show(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon,
                                               MessageBoxResult defaultResult, string dontShowAgainKey, bool isDependenciesButtonVisible,
                                               bool isError, bool isInfo, bool isQuestion, List <string> urlsFound, bool isDeleteAnywayButtonVisible, bool applyToAll)
        {
            // Check for don't show again option
            var dontShowAgainOption = GetDontShowAgainOption(dontShowAgainKey);
            var msgBoxViewModel     = new MessageBoxViewModel(messageBoxText, caption, button, FontAwesomeIcon.ExclamationTriangle, isDependenciesButtonVisible, isError, isInfo, isQuestion, urlsFound, isDeleteAnywayButtonVisible, applyToAll);

            if (dontShowAgainOption.Item1)
            {
                // Return the remembered option
                msgBoxViewModel.Result = dontShowAgainOption.Item2;
                return(msgBoxViewModel);
            }

            if (caption != "Duplicated Resources")
            {
                urlsFound = new List <string>();
            }



            var msgBoxView = new MessageBoxView
            {
                DataContext = msgBoxViewModel
            };

            msgBoxViewModel.IsDuplicatesVisible = urlsFound.Count > 0;
            msgBoxViewModel.IsError             = isError;
            msgBoxViewModel.IsInfo     = isInfo;
            msgBoxViewModel.IsQuestion = isQuestion;
            msgBoxViewModel.IsDependenciesButtonVisible = isDependenciesButtonVisible;
            msgBoxViewModel.IsDeleteAnywayButtonVisible = isDeleteAnywayButtonVisible;
            msgBoxViewModel.ApplyToAll = applyToAll;

            msgBoxView.ShowDialog();

            return(msgBoxViewModel);
        }
Exemplo n.º 17
0
 public void NotifyAboutZeroRulesInResponse()
 {
     MessageBoxView.Show("Dla wprowadzonych wartości parametrów algorytm nie zwrócił żadnego wyniku.",
                         "Informacja", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Exemplo n.º 18
0
 public void NotifyAboutUnsupportedFileSelected()
 {
     MessageBoxView.Show("Załadowny format pliku nie jest obsługiwany. Listę wspieranych formatów można znaleźć w instrukcji obsługi.",
                         "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
Exemplo n.º 19
0
 public static IMessageBoxViewController CreateMessageBoxViewController(MessageBoxView messageBoxView)
 {
     return(MessageBoxViewController.Create(messageBoxView));
 }
Exemplo n.º 20
0
 public void NotifyAboutNotMarketAtLeastOneAttributeAsDecision()
 {
     MessageBoxView.Show("W systemie nie ustawiono ani jednego atrybutu decyzyjnego.",
                         "Informacja", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Exemplo n.º 21
0
 private MessageBoxViewController(MessageBoxView messageBoxView)
 {
     _messageBoxView = messageBoxView;
     Hide();
 }
Exemplo n.º 22
0
 public void NotifyAboutArgumentCountIncorrect()
 {
     MessageBoxView.Show("Liczba atrybutów w poszczególnych wierszach musi być identyczna.",
                         "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
Exemplo n.º 23
0
 public void NotifyAboutNoPermissionsToFile()
 {
     MessageBoxView.Show("Brak uprawnień do pliku lub jest on obecnie wykorzystywany przez inny proces.",
                         "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
Exemplo n.º 24
0
 public void NotifyAboutMissingInstruction()
 {
     MessageBoxView.Show("Plik z instrukcją nie został znaleziony.",
                         "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
 }
Exemplo n.º 25
0
 public void NotifyAboutRowsNotParsedCorrectly()
 {
     MessageBoxView.Show("Błąd przy parsowaniu wierszy z danymi. Poprawny format zapisu zbiorów danych dla poszczególnych formatów plików można znaleźć w instrukcji.",
                         "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
Exemplo n.º 26
0
 public void NotifyAboutIncorrectNumberOfFilesInArchive()
 {
     MessageBoxView.Show("Nieprawidłowa liczba plików w archiwum. Poprawny opis zawartości archiwum można znaleźć w instrukcji.",
                         "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
Exemplo n.º 27
0
 public void NotifyAboutIncorrectArchive()
 {
     MessageBoxView.Show("Archiwum jest uszkodzone.",
                         "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
Exemplo n.º 28
0
 public void NotifyAboutMissingDefaultPdfReader()
 {
     MessageBoxView.Show("W systemie nie zdefiniowano domyślnego programu do odczyty plików pdf.",
                         "Informacja", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }