Esempio n. 1
0
        /// <summary>
        /// Confirms the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="callback">The callback.</param>
        public void Confirm(string message, Action callback)
        {
            var commandListVm = new CommandListPopupViewModel();
            commandListVm.CommandList.Add(new TitledCommand(CallbackCommand, LanguageService.Translate("Cmd_Yes"), callback));
            commandListVm.CommandList.Add(new TitledCommand(CloseCommand, LanguageService.Translate("Cmd_No"), callback));

            var popupBuilder = Popup();
            popupBuilder.SetPosition(PopupPosition.Center)
                        .Duration(0)
                        .Message(message)
                        .IsCalloutVisible(false)
                        .SetIsModal(true)
                        .SetCaption(LanguageService.Translate("Msg_Confirm"))
                        .SetIconURL("/Cebos.Veyron.Common.SL;component/Assets/Icons/question.png")
                        .SetHasDetails(false)
                        .SetCommandList(commandListVm)
                        .Show();
        }
Esempio n. 2
0
        /// <summary>
        /// Notifies the failure.
        /// </summary>
        /// <param name="error">The error.</param>
        /// <param name="title">The title.</param>
        /// <param name="duration">The duration.</param>
        /// <param name="isModal">if set to <c>true</c> [is modal].</param>
        public void NotifyFailure(string error, string title = "Popup_Error", int duration = 3, bool isModal = false)
        {
            title = LanguageService.Translate(title);

            var popupBuilder = Popup();
            var commandListVm = new CommandListPopupViewModel();
            commandListVm.CommandList.Add(new TitledCommand(CopySystemInfoCommand, LanguageService.Translate("Msg_CopyToClipboard"), popupBuilder));

            popupBuilder.SetPosition(PopupPosition.Right)
                        .Duration(duration)
                        .Message(error)
                        .IsCalloutVisible(false)
                        .SetIsModal(isModal)
                        .SetCommandList(commandListVm)
                        .SetCaption(title)
                        .SetIconURL("/Cebos.Veyron.Common.SL;component/Assets/Icons/failure.png")
                        .Show();
        }
Esempio n. 3
0
        /// <summary>
        /// Notifies the failure internal.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="message">The message.</param>
        /// <param name="details">The details.</param>
        /// <param name="isModal">if set to <c>true</c> [is modal].</param>
        /// <param name="messageToken">The message token.</param>
        private void NotifyFailureInternal(string title, string message, string details, bool isModal, string messageToken)
        {
            var resources = new ResourceDictionary { Source = new Uri("/Cebos.Veyron.Common.SL;component/Assets/Theme.xaml", UriKind.Relative) };
            var popupBuilder = Popup();
            var commandListVm = new CommandListPopupViewModel();
            commandListVm.CommandList.Add(new TitledCommand(CopySystemInfoCommand, LanguageService.Translate("Msg_CopyToClipboard"), popupBuilder));

            if (!string.IsNullOrEmpty(messageToken))
            {
                var vm = CustomNotificationViewModel.CreateExport().Value;
                vm.Message = message;
                vm.Token = messageToken;

                popupBuilder.SetCustomViewModel(vm);
            }

            popupBuilder.SetPosition(PopupPosition.Right)
                        .Duration(isModal ? 0 : 3)
                        .Message(message)
                        .IsCalloutVisible(false)
                        .SetIsModal(isModal)
                        .SetCaption(title)
                        .SetCaptionColor(resources["PopupErrorGradient"] as LinearGradientBrush)
                        .SetIconURL("/Cebos.Veyron.Common.SL;component/Assets/Icons/failure.png")
                        .SetHasDetails(true)
                        .SetDetailsMessage(details)
                        .SetCommandList(commandListVm)
                        .Show();
        }
Esempio n. 4
0
        /// <summary>
        /// Notifies the message.
        /// </summary>
        /// <param name="successfullySaved">The successfully saved.</param>
        /// <param name="title">The title.</param>
        /// <param name="duration">The duration.</param>
        /// <param name="callback">The callback.</param>
        public virtual void NotifyMessage(string successfullySaved, string title = "Popup_Message", int duration = 3, Action callback = null)
        {
            title = LanguageService.Translate(title);

            var popupBuilder = Popup();
            var commandListVm = new CommandListPopupViewModel();
            commandListVm.CommandList.Add(new TitledCommand(CallbackCommand, LanguageService.Translate("Popup_Open"), callback));
            commandListVm.CommandList.Add(new TitledCommand(CopySystemInfoCommand, LanguageService.Translate("Cmd_Close"), popupBuilder));

            popupBuilder.SetPosition(PopupPosition.Right)
                        .Duration(duration)
                        .Message(successfullySaved)
                        .IsCalloutVisible(false)
                        .SetIsModal(false)
                        .SetCaption(title)
                        .SetCommandList(commandListVm)
                        .SetIconURL("/Cebos.Veyron.Common.SL;component/Assets/Icons/mail_24.png")
                        .Show();
        }
Esempio n. 5
0
        /// <summary>
        /// Sets the command list.
        /// </summary>
        /// <param name="commandListVm">The command list vm.</param>
        /// <returns>PopupBuilder.</returns>
        public PopupBuilder SetCommandList(CommandListPopupViewModel commandListVm)
        {
            CommandListVM = CommandListFactory.CreateExport().Value;
            if (commandListVm != null)
            {
                AddCommandRange(commandListVm.CommandList);
                CommandListVM.NotificationMessage = commandListVm.NotificationMessage;
            }

            CommandListVM.Closed += CustomViewModelClosed;

            return this;
        }
 public void PropertiesTests()
 {
     var vm = new CommandListPopupViewModel();
     TestsHelper.TestPublicDeclaredPropertiesGetSet(vm, true);
 }