Пример #1
0
 public bool addSavePath(AWindow window)
 {
     string new_path;
     System.Windows.Forms.FolderBrowserDialog folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
     folderBrowser.ShowNewFolderButton = true;
     folderBrowser.Description = Strings.GetLabelString("SelectAltPath");
     bool try_again = false;
     do {
         if (folderBrowser.ShowDialog(window.GetIWin32Window()) == System.Windows.Forms.DialogResult.OK) {
             new_path = folderBrowser.SelectedPath;
             if (PermissionsHelper.isReadable(new_path)) {
                 if (Core.settings.addSavePath(new_path)) {
                     try_again = false;
                     return true;
                 } else {
                     this.showTranslatedError("SelectAltPathDuplicate");
                     try_again = true;
                 }
             } else {
                 this.showTranslatedError("SelectAltPathDuplicate");
                 try_again = true;
             }
         } else {
             try_again = false;
         }
     } while (try_again);
     return false;
 }
Пример #2
0
 public MessageBox(string title, string message, AWindow owner)
     : base(owner)
 {
     InitializeComponent();
     this.Title = title;
     messageLabel.Content = message;
 }
Пример #3
0
 public ChoiceWindow(string title, string message, List<string> options, string default_option, AWindow owner)
     : base(owner)
 {
     InitializeComponent();
     int selected = 0;
     this.Title = title;
     messageGrp.Header = message;
     foreach(string add_me in options) {
         choiceCombo.Items.Add(add_me);
         if(add_me==default_option)
             choiceCombo.SelectedIndex = selected;
         selected++;
     }
 }
Пример #4
0
 public MessageBox(string title, string message, RequestType type, AWindow owner)
     : this(title,message,owner)
 {
     if(type== RequestType.Question) {
         cancelButton.Visibility = System.Windows.Visibility.Visible;
         submitButton.Visibility = System.Windows.Visibility.Collapsed;
         okButton.Content = "Yes";
         cancelButton.Content = "No";
         questionIcon.Visibility =  System.Windows.Visibility.Visible;
         exceptionExpander.Visibility = System.Windows.Visibility.Collapsed;
     } else {
         this.DialogResult = false;
         throw new NotImplementedException();
     }
 }
Пример #5
0
        public bool addSavePath(AWindow window)
        {
            string new_path;

            System.Windows.Forms.FolderBrowserDialog folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
            folderBrowser.ShowNewFolderButton = true;
            folderBrowser.Description         = Strings.GetLabelString("SelectAltPath");
            bool try_again = false;

            do
            {
                if (folderBrowser.ShowDialog(window.GetIWin32Window()) == System.Windows.Forms.DialogResult.OK)
                {
                    new_path = folderBrowser.SelectedPath;
                    if (PermissionsHelper.isReadable(new_path))
                    {
                        if (Core.settings.addSavePath(new_path))
                        {
                            try_again = false;
                            return(true);
                        }
                        else
                        {
                            this.showTranslatedError("SelectAltPathDuplicate");
                            try_again = true;
                        }
                    }
                    else
                    {
                        this.showTranslatedError("SelectAltPathDuplicate");
                        try_again = true;
                    }
                }
                else
                {
                    try_again = false;
                }
            } while (try_again);
            return(false);
        }
Пример #6
0
 public MessageBox(string title, string message, Exception e, MessageTypes type, AWindow owner)
     : this(title, message, owner)
 {
     switch(type) {
         case MessageTypes.Error:
             cancelButton.Visibility = System.Windows.Visibility.Collapsed;
             if(e!=null) {
                 exceptionExpander.Visibility = System.Windows.Visibility.Visible;
                 exceptionText.Text = recurseExceptions(e);
                 if(e.GetType()==typeof(MException)) {
                     if(((MException)e).submittable)
                         submitButton.Visibility = System.Windows.Visibility.Visible;
                     else
                         submitButton.Visibility = System.Windows.Visibility.Collapsed;
                 } else {
                     submitButton.Visibility = System.Windows.Visibility.Visible;
                 }
             } else {
                 submitButton.Visibility = System.Windows.Visibility.Collapsed;
                 exceptionExpander.Visibility = System.Windows.Visibility.Collapsed;
             }
             okButton.Content = "Close";
             errorIcon.Visibility =  System.Windows.Visibility.Visible;
             break;
         case MessageTypes.Info:
             cancelButton.Visibility = System.Windows.Visibility.Collapsed;
             exceptionExpander.Visibility = System.Windows.Visibility.Collapsed;
             submitButton.Visibility = System.Windows.Visibility.Collapsed;
             okButton.Content = "OK";
             infoIcon.Visibility = System.Windows.Visibility.Visible;
             break;
         case MessageTypes.Warning:
             cancelButton.Visibility = System.Windows.Visibility.Collapsed;
             exceptionExpander.Visibility = System.Windows.Visibility.Collapsed;
             submitButton.Visibility = System.Windows.Visibility.Collapsed;
             okButton.Content = "OK";
             warningIcon.Visibility = System.Windows.Visibility.Visible;
             break;
     }
 }
Пример #7
0
 public EmailWindow(AWindow owner)
     : base(owner)
 {
     InitializeComponent();
 }
Пример #8
0
 /// <summary> 
 /// Remove Blur Effects 
 /// </summary> 
 /// <param name=”win”></param> 
 private void ClearEffect(AWindow win)
 {
     win.Effect = null;
 }
Пример #9
0
        public AWindow(AWindow owner)
            : base()
        {
            TabItem from_me = new TabItem();
            from_me.BeginInit();
            from_me.EndInit();
            this.Background = from_me.Background;
            ProgressBar from_color = new ProgressBar();
            default_progress_color = from_color.Foreground;

            // Taskbar progress setup
            TaskbarItemInfo = new TaskbarItemInfo();
            var uriSource = new Uri(System.IO.Path.Combine(Core.app_path,"masgau.ico"), UriKind.Relative);
            this.Icon = new BitmapImage(uriSource);
            if(owner!=null) {
                this.Owner = owner;
                this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            } else {
                this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            }

            // Jumplist setup
            JumpList masgau_jump_list = JumpList.GetJumpList(Application.Current);
            if(masgau_jump_list==null) {
                masgau_jump_list = new JumpList();
                JumpList.SetJumpList(Application.Current, masgau_jump_list);
            } else {
                masgau_jump_list.JumpItems.Clear();
                masgau_jump_list.ShowFrequentCategory = false;
                masgau_jump_list.ShowRecentCategory = false;

            }

            JumpTask masgau_jump = new JumpTask();
            masgau_jump.ApplicationPath = Path.Combine(Core.app_path,"MASGAU.Main.WPF.exe");
            masgau_jump.IconResourcePath = Path.Combine(Core.app_path,"masgau.ico");
            masgau_jump.WorkingDirectory = Core.app_path;
            masgau_jump.Title = "Main Program";
            masgau_jump.Description = "Open MASGAU's Main Window";
            masgau_jump.CustomCategory = "MASGAU";
            masgau_jump_list.JumpItems.Add(masgau_jump);

            masgau_jump = new JumpTask();
            masgau_jump.ApplicationPath = Path.Combine(Core.app_path,"MASGAU.Main.WPF.exe");
            masgau_jump.IconResourcePath = Path.Combine(Core.app_path,"masgau.ico");
            masgau_jump.WorkingDirectory = Core.app_path;
            masgau_jump.Title = "Main Program (All Users Mode)";
            masgau_jump.Description = "Open MASGAU's Main Window In All Users Mode";
            masgau_jump.Arguments = "-allusers";
            masgau_jump.CustomCategory = "MASGAU";
            masgau_jump_list.JumpItems.Add(masgau_jump);

            masgau_jump = new JumpTask();
            masgau_jump.ApplicationPath = Path.Combine(Core.app_path,"MASGAU.Analyzer.WPF.exe");
            masgau_jump.IconResourcePath = Path.Combine(Core.app_path,"masgau.ico");
            masgau_jump.WorkingDirectory = Core.app_path;
            masgau_jump.Title = "Analyzer";
            masgau_jump.Description = "Open MASGAU's Save Game Analyzer";
            masgau_jump.CustomCategory = "MASGAU";
            masgau_jump_list.JumpItems.Add(masgau_jump);

            masgau_jump = new JumpTask();
            masgau_jump.ApplicationPath = Path.Combine(Core.app_path,"MASGAU.Monitor.WPF.exe");
            masgau_jump.IconResourcePath = Path.Combine(Core.app_path,"masgau.ico");
            masgau_jump.WorkingDirectory = Core.app_path;
            masgau_jump.Title = "Monitor";
            masgau_jump.Description = "Open MASGAU's Monitor";
            masgau_jump.CustomCategory = "MASGAU";
            masgau_jump_list.JumpItems.Add(masgau_jump);

            masgau_jump_list.Apply();

            //These intitialize the contexts of the CommunicationHandlers
            if(SynchronizationContext.Current == null)
                SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(this.Dispatcher));
            _context = SynchronizationContext.Current;

            CommunicationHandler.addReceiver(this);

            this.Closing += new CancelEventHandler(Window_Closing);
        }
Пример #10
-1
 private void ApplyEffect(AWindow win)
 {
     System.Windows.Media.Effects.BlurEffect objBlur =
        new System.Windows.Media.Effects.BlurEffect();
     objBlur.Radius = 4;
     win.Effect = objBlur;
 }