Exemple #1
0
 public static TrayIcon GetInstance()
 {
     return(Me ?? (Me = new TrayIcon()));
 }
        public PopWindow()
        {
            InitializeComponent();
            Me                 = this;
            _trayIcon          = Control.TrayIcon.GetInstance();
            _trayIcon.Invoked += TrayIcon_Invoked;


            //G1.Background = null;



            // Move keyboard focus to the first element. Disabled this since it is ugly but not sure invisible
            // visuals are preferrable.
            // Activated += (s,e) => MoveFocus(new TraversalRequest(FocusNavigationDirection.First));

            SourceInitialized += (s, e) => UpdateTheme();
            InitializeTimer();
            R2.Height   = new GridLength(1, GridUnitType.Auto);
            R1.Height   = new GridLength(0);
            R0.Height   = new GridLength(0);
            Arrow1.Fill = this.Foreground;
            Arrow2.Fill = this.Foreground;

            var t = Program.ReadSetting("TopWindows", "0");

            if (t == "1")
            {
                this.Topmost = true;
            }
            else
            {
                this.Topmost = false;
            }
            var c = Program.ReadSetting("Chart", "0");

            if (c == "1")
            {
                Chart(true);
            }
            else
            {
                Chart(false);
            }
            var m = Program.ReadSetting("Max", "1");

            if (m == "1")
            {
                Max(true);
            }
            else
            {
                Max(false);
            }
            var h = Program.ReadSetting("Hiden", "0");

            if (h == "1")
            {
                CreateAndHideWindow();
            }
            else
            {
                CreateAndShowWindow();
            }
            double temp = MaxDownload;

            _           = double.TryParse(Program.ReadSetting("MaxDownload", "0"), out temp);
            MaxDownload = temp;
            SetMaxDownload(MaxDownload);
            //
            detailWindow = new DetailWindow(this);
            detailWindow.IsVisibleChanged += DetailWindow_IsVisibleChanged;
            var menu = new System.Windows.Controls.ContextMenu
            {
                ItemsSource = _trayIcon.BuildContextMenu(false).Items
            };

            //this.ContextMenu = menu;
            App.Pin(this);
        }