Example #1
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         AddVersionNumber();
         CheckForUpdates();
         LoadOptions();
         NetworkScanner.PublishDevice();
         NetworkScanner.ScanAvailableDevices();
         NetworkScanner.OnScanCompleted   += NetworkScanner_OnScanCompleted;
         NetworkScanner.OnClientConnected += NetworkScanner_OnClientConnected;
         Dispatcher.Invoke(() =>
         {
             chc_AutoShare.IsChecked      = Parameters.IsAutoShareEnabled;
             chc_EnableControls.IsChecked = Parameters.IsControlsEnabled;
             IsControlsEnabled            = Parameters.IsControlsEnabled;
         });
         if (Parameters.IsAutoShareEnabled)
         {
             //if (ServiceBot)
             //{
             Task.Run(() =>
             {
                 try
                 {
                     bool noIP = true;
                     while (noIP)
                     {
                         var localIP = NetworkScanner.MyIP;
                         if (localIP != null)
                         {
                             char[] splitter = { '.' };
                             var ipBlocks    = localIP.ToString().Split(splitter);
                             if (string.Equals(ipBlocks[0], "192") && string.Equals(ipBlocks[1], "168"))
                             {
                                 noIP = false;
                             }
                         }
                         Thread.Sleep(500);
                     }
                     btn_Share_Click(null, null);
                 }
                 catch (Exception exc)
                 {
                     Debug.WriteLine("Exception in loading: " + exc.ToString());
                 }
             });
             //}
             //else
             //{
             //    btn_Share_Click(null, null);
             //}
         }
     }
     catch
     {
         Debug.WriteLine("Failed when initializing ");
     }
 }
Example #2
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     if (!Parameters.DidInitParameters)
     {
         Parameters.Init();
         Thread.CurrentThread.CurrentUICulture = new CultureInfo(Parameters.DeviceLanguage);
         Properties.Resources.Culture          = new CultureInfo(Parameters.DeviceLanguage);
         Task.Run(() => ScanNetwork());
     }
     Main.StartServer();
     NetworkScanner.PublishDevice();
     Navigator.Navigate("Pages/SplashScreen.xaml");
     CheckForUpdates();
     AddVersionNumber();
 }