示例#1
0
        private bool askUserAppUpdate(string thisVersion, string latestVersion)
        {
            m_Logger.Log("ShellView.askUserAppUpdate", Category.Debug, Priority.Medium);

            var label = new TextBlock
            {
                Text   = Tobi_Lang.TobiUpdate_Message,
                Margin = new Thickness(8, 0, 8, 0),
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Center,
                Focusable           = true,
                TextWrapping        = TextWrapping.Wrap
            };

            var label2 = new TextBlock
            {
                Text   = "[" + thisVersion + " --> " + latestVersion + "]",
                Margin = new Thickness(8, 0, 8, 8),
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Center,
                Focusable           = true,
                TextWrapping        = TextWrapping.Wrap
            };

            var iconProvider = new ScalableGreyableImageProvider(LoadTangoIcon("help-browser"), MagnificationLevel);

            var panel = new StackPanel
            {
                Orientation         = Orientation.Horizontal,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
            };

            panel.Children.Add(iconProvider.IconLarge);

            var panel2 = new StackPanel
            {
                Orientation         = Orientation.Vertical,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Center,
            };

            panel.Children.Add(panel2);

            panel2.Children.Add(label);
            panel2.Children.Add(label2);
            //panel.Margin = new Thickness(8, 8, 8, 0);


            //var details = new TextBoxReadOnlyCaretVisible
            //                  {
            //    TextReadOnly = Tobi_Lang.ExitConfirm
            //};

            var windowPopup = new PopupModalWindow(this,
                                                   UserInterfaceStrings.EscapeMnemonic(Tobi_Lang.TobiUpdate_Title),
                                                   panel,
                                                   PopupModalWindow.DialogButtonsSet.YesNo,
                                                   PopupModalWindow.DialogButton.No,
                                                   true, 400, 200, null, 40, null);

            windowPopup.ShowModal();

            if (PopupModalWindow.IsButtonOkYesApply(windowPopup.ClickedDialogButton))
            {
                if (m_UrakawaSession != null &&
                    m_UrakawaSession.DocumentProject != null && m_UrakawaSession.IsDirty)
                {
                    PopupModalWindow.DialogButton button = m_UrakawaSession.CheckSaveDirtyAndClose(PopupModalWindow.DialogButtonsSet.YesNoCancel, "exit");
                    if (PopupModalWindow.IsButtonEscCancel(button))
                    {
                        return(false);
                    }
                }

                return(true);
            }

            return(false);
        }