Ejemplo n.º 1
0
 /// <summary>
 /// Constructor for HelperManager
 /// </summary>
 /// <param name="ownerWindow">Setting the owner of windowHelper to ownerWindow</param>
 public HelperManager(Window ownerWindow)
 {
     settingsManager    = Settings.Instance;
     windowHelper       = new HelperWindow();
     windowHelper.Owner = ownerWindow;
     windowHelper.Show();
     windowHelper.Visibility = Visibility.Hidden;
 }
        /// <summary>
        /// Constructor for HelperManager
        /// </summary>
        /// <param name="ownerWindow">Setting the owner of windowHelper to ownerWindow</param>
        public HelperManager(Window ownerWindow)
        {
            settingsManager = Settings.Instance;

            windowHelper = new HelperWindow();
            windowHelper.Owner = ownerWindow;
            mainWindow = ownerWindow;
            windowHelper.Show();
            windowHelper.Visibility = Visibility.Hidden;
        }
        /// <summary>
        /// Tell windowHelper to display the notification
        /// </summary>
        /// <param name="helpString">The string to be displayed in the notifiation window</param>
        /// <param name="priority">The piority of the window to be displayed</param>
        /// <param name="windowPosition">The position for which the notification window should be placed</param>
        public void Show(string helpString, int priority, HelperWindow.windowStartPosition windowPosition)
        {
            if (priority == -2)
            {
                windowHelper.MainWindow = mainWindow;
                string extraHelpString = "Click here to quit nsync.";
                windowHelper.SetSettings(helpString, -1, windowPosition, "QUIT_NSYNC", extraHelpString);
                windowHelper.ButtonClose.Visibility = Visibility.Hidden;

                if (windowHelper.Visibility != Visibility.Visible && windowHelper.IsLoaded)
                {
                    windowHelper.Visibility = Visibility.Visible;
                    windowHelper.FormFade.Begin(windowHelper);
                }
            }

            else
            {
                if (helperWindowIsOn() || (priority == -1) || (priority == 0))
                {
                    if (priority == -1)
                    {
                        if ((errorCount == 0) && (conflictCount == 0))
                            windowHelper.SetSettings(helpString, determineTimer(priority), windowPosition, null, null);
                        else
                        {
                            if (errorCount == 1)
                                helpString += " " + errorCount + " file not synchronized.";
                            else
                                helpString += " " + errorCount + " files not synchronized.";
                            if (conflictCount == 1)
                                helpString += " " + conflictCount + " file conflicted.";
                            else
                                helpString += " " + conflictCount + " files conflicted.";
                            string extraHelpString = "Click here to view Log.";
                            windowHelper.SetSettings(helpString, determineTimer(priority), windowPosition, logPath, extraHelpString);
                        }
                    }

                    else
                    {
                        if (isRevertPathDialog)
                        {
                            string extraHelpString = "Click here to revert changes.";
                            windowHelper.HyperTextMouseDown += new System.Windows.Input.MouseButtonEventHandler(windowHelper_HyperTextMouseDown);
                            windowHelper.SetSettings(helpString, determineTimer(priority), windowPosition, null, extraHelpString);
                        }
                        else
                            windowHelper.SetSettings(helpString, determineTimer(priority), windowPosition, null, null);
                    }

                    if (windowHelper.Visibility != Visibility.Visible && windowHelper.IsLoaded)
                    {
                        windowHelper.Visibility = Visibility.Visible;
                        windowHelper.FormFade.Begin(windowHelper);
                    }
                }
            }
        }