Ejemplo n.º 1
0
        public void Initalize(ref Scanner scanner)
        {
            //Init here
            _scanner = scanner;
            _scanner.ScanComplete += ScannerScanComplete;

            timeGraph1.SetScanner(ref _scanner);
            scannerViewMini1.SetScanner(ref _scanner);
            scannerViewMini1.RequireRefresh += ScannerViewMini1RequireRefresh;

            channelView24.SetScanner(ref _scanner);
            channelView5Low.SetScanner(ref _scanner);
            channelView5High.SetScanner(ref _scanner);

            filterMgr1.SetScanner(ref _scanner);

            gpsMon1.SetScanner(ref _scanner);

            networkInterfaceSelector1.Initialize(ref _scanner);
            networkInterfaceSelector1.NetworkScanStartEvent += NetworkInterfaceSelector1NetworkScanStartEvent;
            networkInterfaceSelector1.NetworkScanStopEvent += NetworkInterfaceSelector1NetworkScanStopEvent;

            _scanner.GpsControl.GpsLocationUpdated += GpsControl_GpsLocationUpdated;

            UpdateButtonsStatus();

            //Load settings
            SettingsMgr.ApplyScannerViewMiniSettings(scannerViewMini1);
        }
Ejemplo n.º 2
0
        public void SetScanner(ref Scanner scanner)
        {
            _scanner = scanner;
            _scanner.GpsControl.GpsStatUpdated += GpsControl_GpsStatUpdated;
            _scanner.GpsControl.GpsMessage += GpsControl_GpsMessage;

            gpsGraph1.SetScanner(ref scanner);
            UpdateView();
        }
Ejemplo n.º 3
0
 public void SetScanner(ref Scanner s)
 {
     _sc = s;
 }
Ejemplo n.º 4
0
 public void SetScanner(ref Scanner scanner)
 {
     _scanner = scanner;
 }
Ejemplo n.º 5
0
 public void SetScanner(ref Scanner scanner)
 {
     _sc = scanner;
     _sc.Cache.DataReset += Cache_DataReset;
 }
Ejemplo n.º 6
0
 public void SetScanner(ref Scanner s)
 {
     _sc = s;
     _sc.Cache.FiltersChanged += Cache_FiltersChanged;
     UpdateFilters();
 }
Ejemplo n.º 7
0
        public void Initalize(ref Scanner scanner)
        {
            _scanner = scanner;
            _scanner.ScanComplete += ScannerScanComplete;

            //_sc.StartScanning(_sc.AvalibleWlanInterfaces[0], 1000);
            //_updateTimer.Start();

            timeGraph1.SetScanner(ref _scanner);
            scannerView.SetScanner(ref _scanner);
            scannerView.RequireRefresh += ScannerViewRequireRefresh;
            chanView24.SetScanner(ref _scanner);
            chanView58.SetScanner(ref _scanner);
            filterMgr1.SetScanner(ref _scanner);
            networkInterfaceSelector1.Initialize(ref _scanner);
            networkInterfaceSelector1.NetworkScanStartEvent += NetworkInterfaceSelectorNetworkScanStartEvent;
            networkInterfaceSelector1.NetworkScanStopEvent += NetworkInterfaceSelectorNetworkScanStopEvent;

            _gpsStatTimer = new Timer(1000);
            _gpsStatTimer.Elapsed += GpsStatTimerElapsed;

            gpsMon1.SetScanner(ref _scanner);
            UpdateButtonsStatus();

            //Load settings
            SettingsMgr.ApplyScannerViewSettings(scannerView);
        }
 public void Initialize(ref Scanner scanner)
 {
     _scanner = scanner;
     if(_scanner == null) return;
     //NetworkController.Instance.Initialize();
     if (Utilities.IsXp())
     {
         _myTimer = new System.Timers.Timer { Interval = 5000.0, Enabled = true };
         _myTimer.Elapsed += MyTimer_Elapsed;
     }
     else if (_scanner.WlanClient != null)
     {
         _scanner.WlanClient.InterfaceArrivedEvent += WlanClient_InterfaceAddedEvent;
         _scanner.WlanClient.InterfaceRemovedEvent += WlanClient_InterfaceRemoveEvent;
     }
     UpdateInterfaceList();
     //if ((this.NetworkInterfaceDropDown.DropDownItems.Count > 0) && Settings.Default.AutoStartWiFi)
     //{
     //    this.StartScan();
     //}
 }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            //TODO: Make conmmand line option to enable logging on debug builds. Like /log
            #if DEBUG && LOG
            Log.Start();
            #endif
            // Create new instance of UnhandledExceptionDlg:
            // NOTE: this hooks up the exception handler functions
            UnhandledExceptionDlg exDlg = new UnhandledExceptionDlg();
            InitializeExceptionHandler(exDlg);

            //Check for config system condition here
            if(!Settings.Default.CheckSettingsSystem())
            {
                //The settings system is broken, notify and exit
                MessageBox.Show(
                    Localizer.GetString("ConfigSystemError"),
                    "Error", MessageBoxButtons.OK,MessageBoxIcon.Error);
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //The main form will run unless mini is specified
            IScannerUi form;

            if(Settings.Default.lastMini)
            {
                form = new FormMini();
                SettingsMgr.ApplyMiniFormSettings((Form)form);
            }
            else
            {
                form = new FormMain();
                SettingsMgr.ApplyMainFormSettings((Form)form);
            }

            //Initalize the scanner object before passing it to any interface
            Scanner scanner = new Scanner();
            Exception ex;

            scanner.Initalize(out ex);
            if (ex != null)
            {
                //An error!
                scanner.Dispose();
                scanner = null;
                //So the error handler will catch it
                //throw ex;

                //Log it
                Log.WriteLine(string.Format("Exception message:\r\n\r\n{0}\r\n\r\nStack trace:\r\n{1}", ex.Message, ex.StackTrace));

                if (ex is System.ComponentModel.Win32Exception)
                {
                    //The wireless system failed
                    if (Utilities.IsXp())
                    {
                        MessageBox.Show(Localizer.GetString("WlanServiceNotFoundXP"), "Error", MessageBoxButtons.OK,
                                        MessageBoxIcon.Hand);
                    }
                    else
                    {
                        MessageBox.Show(Localizer.GetString("WlanServiceNotFound7"), "Error", MessageBoxButtons.OK,
                                        MessageBoxIcon.Hand);
                    }
                }
                else
                {
                    //Any other exceptions
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
                                        MessageBoxIcon.Hand);
                }
            }

            if (scanner == null) return;

            //Apply settings now
            SettingsMgr.ApplyGpsSettings(scanner.GpsControl);

            do
            {
                //Check for switching
                switch (Switching)
                {
                    case Utilities.SwitchMode.None:
                        //We're not switching, close program
                        break;
                    case Utilities.SwitchMode.ToMain:
                        //We're switching to the main form
                        form = new FormMain();
                        SettingsMgr.ApplyMainFormSettings((Form)form);
                        break;
                    case Utilities.SwitchMode.ToMini:
                        //We're switching to the mini form
                        form = new FormMini();
                        SettingsMgr.ApplyMiniFormSettings((Form)form);
                        break;
                }
                //If' we've switched, we don't need to get stuck in a loop
                Switching = Utilities.SwitchMode.None;

                form.Initalize(ref scanner);
                try
                {
                    Application.Run((Form)form);
                }
                catch (ObjectDisposedException)
                {

                }

            } while (Switching != Utilities.SwitchMode.None);

            Settings.Default.lastMini = form.GetType() == typeof(FormMini);

            //Save settings before exit
            Settings.Default.Save();

            //Dispose the scanner, we're done with it
            scanner.Dispose();
        }