Esempio n. 1
0
        private void Window1_Loaded(object sender, RoutedEventArgs e)
        {
            //       AeroGlassHelper.ExtendGlass(this, (int)windowContent.Margin.Left, (int)windowContent.Margin.Right, (int)windowContent.Margin.Top, (int)windowContent.Margin.Bottom);

            txtSSID.Text     = Settings.Default.SSID;
            txtPassword.Text = Settings.Default.Password;
            txtIP.Text       = Settings.Default.IP;

            // This line is for testing purposes
            //panelConnections.Children.Add(new PeerDevice(new ConnectedPeer() { MacAddress = "AA-22-33-EE-EE-FF" }));

            var args   = System.Environment.GetCommandLineArgs();
            var minarg = (from a in args
                          where a.ToLowerInvariant().Contains("/min")
                          select a).FirstOrDefault();

            if (!string.IsNullOrEmpty(minarg))
            {
                this.WindowState   = WindowState.Minimized;
                this.ShowInTaskbar = false;
            }

            this.AddSystemMenuItems();

            this.threadUpdateUI = new Thread(new ThreadStart(this.UpdateUIThread));
            this.threadUpdateUI.Start();

            this.Closed += new EventHandler(Window1_Closed);

            this.trayIcon = new WpfNotifyIcon();
            this.trayIcon.Show();
            this.trayIcon.DoubleClick += new EventHandler(trayIcon_DoubleClick);

            var trayMenu = new System.Windows.Forms.ContextMenuStrip();

            trayMenu.Items.Add("&Manage Software Getaway", null, new EventHandler(this.TrayIcon_Menu_Manage));
            trayMenu.Items.Add(new System.Windows.Forms.ToolStripSeparator());
            trayMenu.Items.Add("Check for &Updates", null, new EventHandler(this.TrayIcon_Menu_Update));
            trayMenu.Items.Add("&About", null, new EventHandler(this.TrayIcon_Menu_About));
            this.trayIcon.ContextMenuStrip = trayMenu;

            this.StateChanged += new EventHandler(WindowMain_StateChanged);

            varContainer.serviceStopped += new EventHandler(varContainer_serviceStopped);
            varContainer.serviceStarted += new EventHandler(varContainer_serviceStarted);
            varContainer.getawayStarted += new EventHandler(varContainer_getawayStarted);
            varContainer.getawayStopped += new EventHandler(varContainer_getawayStopped);
            varContainer.clientNotify   += new EventHandler(varContainer_clientNotify);
            if (DateTime.Now > DateTime.ParseExact("01.06.2033", "dd.MM.yyyy", null))
            {
                MessageBoxResult result = MessageBox.Show("Your version of Soft Getaway is outdated. Do you want to check for updates?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (result == MessageBoxResult.Yes)
                {
                    Process.Start("http://softgetaway.netai.net");
                }
            }
            UpdateDisplay();
        }
Esempio n. 2
0
        private void Window1_Loaded(object sender, RoutedEventArgs e)
        {
            //       AeroGlassHelper.ExtendGlass(this, (int)windowContent.Margin.Left, (int)windowContent.Margin.Right, (int)windowContent.Margin.Top, (int)windowContent.Margin.Bottom);

            txtSSID.Text = Settings.Default.SSID;
            txtPassword.Text = Settings.Default.Password;
            txtIP.Text = Settings.Default.IP;

            // This line is for testing purposes
            //panelConnections.Children.Add(new PeerDevice(new ConnectedPeer() { MacAddress = "AA-22-33-EE-EE-FF" }));

            var args = System.Environment.GetCommandLineArgs();
            var minarg = (from a in args
                          where a.ToLowerInvariant().Contains("/min")
                          select a).FirstOrDefault();
            if (!string.IsNullOrEmpty(minarg)) {
                this.WindowState = WindowState.Minimized;
                this.ShowInTaskbar = false;
            }

            this.AddSystemMenuItems();

            this.threadUpdateUI = new Thread(new ThreadStart(this.UpdateUIThread));
            this.threadUpdateUI.Start();

            this.Closed += new EventHandler(Window1_Closed);

            this.trayIcon = new WpfNotifyIcon();
            this.trayIcon.Show();
            this.trayIcon.DoubleClick += new EventHandler(trayIcon_DoubleClick);

            var trayMenu = new System.Windows.Forms.ContextMenuStrip();
            trayMenu.Items.Add("&Manage Software Getaway", null, new EventHandler(this.TrayIcon_Menu_Manage));
            trayMenu.Items.Add(new System.Windows.Forms.ToolStripSeparator());
            trayMenu.Items.Add("Check for &Updates", null, new EventHandler(this.TrayIcon_Menu_Update));
            trayMenu.Items.Add("&About", null, new EventHandler(this.TrayIcon_Menu_About));
            this.trayIcon.ContextMenuStrip = trayMenu;

            this.StateChanged += new EventHandler(WindowMain_StateChanged);

            varContainer.serviceStopped += new EventHandler(varContainer_serviceStopped);
            varContainer.serviceStarted += new EventHandler(varContainer_serviceStarted);
            varContainer.getawayStarted += new EventHandler(varContainer_getawayStarted);
            varContainer.getawayStopped += new EventHandler(varContainer_getawayStopped);
            varContainer.clientNotify += new EventHandler(varContainer_clientNotify);
            if (DateTime.Now > DateTime.ParseExact("01.06.2033", "dd.MM.yyyy", null)) {
                MessageBoxResult result = MessageBox.Show("Your version of Soft Getaway is outdated. Do you want to check for updates?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (result == MessageBoxResult.Yes) {
                    Process.Start("http://softgetaway.netai.net");
                }
            }
            UpdateDisplay();
        }