Ejemplo n.º 1
0
 private void InitViewAndNeedClosedResourcees()
 {
     mainWindow = new PopWindow();
     if (Settings.Default.MainWindowLeft > -200000 && Settings.Default.MainWindowTop > -200000)
     {
         mainWindow.Left = Settings.Default.MainWindowLeft;
         mainWindow.Top  = Settings.Default.MainWindowTop;
         Dispatcher.InvokeAsync(new Action(() =>
         {
             Tool.MoveWindowBackToWorkArea(mainWindow, mainWindow.windowPadding);
             mainWindow.isEdgeHide = true;
             mainWindow.TryToEdgeShow();
             mainWindow.TryToEdgeHide();
         }));
     }
     else
     {
         Dispatcher.InvokeAsync(new Action(() =>
         {
             mainWindow.isEdgeHide = true;
             mainWindow.TryToEdgeShow();
             mainWindow.TryToEdgeHide();
             mainWindow.UpdateWindowPosition();
         }));
     }
     mainWindow.Show();
     CheckScreenCount();
     Microsoft.Win32.SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;
     SystemParameters.StaticPropertyChanged += SystemParameters_StaticPropertyChanged;
     timer.Elapsed += Timer_Elapsed;
     timer.Enabled  = true;
 }
Ejemplo n.º 2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.VolumeWindow = ((TrafficWatch.PopWindow)(target));

            #line 15 "..\..\..\View\PopWindow.xaml"
                this.VolumeWindow.Deactivated += new System.EventHandler(this.Window_Deactivated);

            #line default
            #line hidden

            #line 16 "..\..\..\View\PopWindow.xaml"
                this.VolumeWindow.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.Window_PreviewKeyDown);

            #line default
            #line hidden

            #line 21 "..\..\..\View\PopWindow.xaml"
                this.VolumeWindow.MouseEnter += new System.Windows.Input.MouseEventHandler(this.G1_MouseEnter);

            #line default
            #line hidden

            #line 22 "..\..\..\View\PopWindow.xaml"
                this.VolumeWindow.MouseLeave += new System.Windows.Input.MouseEventHandler(this.G1_MouseLeave);

            #line default
            #line hidden

            #line 23 "..\..\..\View\PopWindow.xaml"
                this.VolumeWindow.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.G1_MouseLeftButtonDown);

            #line default
            #line hidden

            #line 24 "..\..\..\View\PopWindow.xaml"
                this.VolumeWindow.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.VolumeWindow_MouseDown);

            #line default
            #line hidden
                return;

            case 2:
                this.LayoutRoot = ((System.Windows.Controls.ScrollViewer)(target));
                return;

            case 3:
                this.G1 = ((System.Windows.Controls.Grid)(target));
                return;

            case 4:
                this.R0 = ((System.Windows.Controls.RowDefinition)(target));
                return;

            case 5:
                this.R1 = ((System.Windows.Controls.RowDefinition)(target));
                return;

            case 6:
                this.R2 = ((System.Windows.Controls.RowDefinition)(target));
                return;

            case 7:
                this.GBlur = ((System.Windows.Controls.Grid)(target));
                return;

            case 8:
                this.M1 = ((System.Windows.Controls.Grid)(target));
                return;

            case 9:

            #line 275 "..\..\..\View\PopWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Exclod_Click);

            #line default
            #line hidden
                return;

            case 10:
                this.Arrow1 = ((System.Windows.Shapes.Path)(target));
                return;

            case 11:
                this.cmbInterface = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 12:
                this.ButtenView = ((System.Windows.Controls.Grid)(target));

            #line 311 "..\..\..\View\PopWindow.xaml"
                this.ButtenView.MouseEnter += new System.Windows.Input.MouseEventHandler(this.ButtenView_MouseEnter);

            #line default
            #line hidden

            #line 311 "..\..\..\View\PopWindow.xaml"
                this.ButtenView.MouseLeave += new System.Windows.Input.MouseEventHandler(this.ButtenView_MouseLeave);

            #line default
            #line hidden

            #line 311 "..\..\..\View\PopWindow.xaml"
                this.ButtenView.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.ButtenView_MouseLeftButtonDown);

            #line default
            #line hidden
                return;

            case 13:
                this.backgroundGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 14:
                this.See = ((System.Windows.Shapes.Path)(target));
                return;

            case 15:
                this.lblInterfaceType = ((System.Windows.Controls.Label)(target));
                return;

            case 16:
                this.lblDownload = ((System.Windows.Controls.Label)(target));
                return;

            case 17:
                this.labelIPAddress = ((System.Windows.Controls.Label)(target));
                return;

            case 18:
                this.lblUpload = ((System.Windows.Controls.Label)(target));
                return;

            case 19:
                this.lblBytesSent = ((System.Windows.Controls.Label)(target));
                return;

            case 20:
                this.lblBytesReceived = ((System.Windows.Controls.Label)(target));
                return;

            case 21:
                this.M2 = ((System.Windows.Controls.Grid)(target));
                return;

            case 22:
                this.M3 = ((System.Windows.Controls.Grid)(target));
                return;

            case 23:
                this.Chart1 = ((TrafficWatch.Control.ChartTraffic)(target));
                return;

            case 24:

            #line 366 "..\..\..\View\PopWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Exclod_Click);

            #line default
            #line hidden
                return;

            case 25:
                this.Arrow2 = ((System.Windows.Shapes.Path)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 3
0
        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);
        }