Example #1
0
        public static bool ShowDownloadWindow(MainWindow mainWindow, AppRegInfo ap, ListBox lb)
        {
            DownloadWindow ownWindow = new DownloadWindow(mainWindow, ap, lb);

            ownWindow.ShowDialog();
            return(ownWindow.status);
        }
Example #2
0
        /// <summary>
        /// Execute when launching this app.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
                System.Version             ver = asm.GetName().Version;

                AutoUpdater.Mandatory = true;
                AutoUpdater.Start("https://raw.githubusercontent.com/chihirobelmo/FalconBMS-Alternative-Launcher/master/Falcon%20BMS%20Alternative%20Launcher/AutoUpdate.xml", asm);

                Diagnostics.Log("Launcher Update Checked");

                string BMS_Launcher_version = "FalconBMS Alternative Launcher v" + ver.Major + "." + ver.Minor + "." + ver.Build;
                AL_Version_Number.Content = BMS_Launcher_version;

                Diagnostics.Log(BMS_Launcher_version);
            }
            catch (Exception ex001)
            {
                Diagnostics.WriteLogFile(ex001);
            }

            try
            {
                RSSReader.Read("https://www.falcon-bms.com/news/feed/", "https://www.falcon-bms.com");
                RSSReader.Read("https://www.falcon-lounge.com/news/feed/", "https://www.falcon-lounge.com");
                RSSReader.Write(News);

                Diagnostics.Log("RSS Read and Write Finished");
            }
            catch (Exception ex002)
            {
                Diagnostics.WriteLogFile(ex002);
            }

            try
            {
                // Load UI Properties(Like Button Status).
                appProperties = new AppProperties(this);

                // Read Registry
                appReg = new AppRegInfo(this);

                BMSChanged();
                ReloadDevices();
            }
            catch (Exception ex003)
            {
                Diagnostics.WriteLogFile(ex003);
                Close();
                return;
            }

            try
            {
                if (DownloadWindow.CheckMajorUpdate(ListBox_BMS))
                {
                    UPDATE_AVAILABLE.Visibility = Visibility.Hidden;
                }
                else
                {
                    DownloadWindow.ShowDownloadWindow(this, appReg, ListBox_BMS);

                    appReg = new AppRegInfo(this);

                    BMSChanged();
                    ReloadDevices();
                }
            }
            catch (Exception ex004)
            {
                Diagnostics.WriteLogFile(ex004);
                Close();
                return;
            }

            try
            {
                if (appReg.getBMSVersion() == BMS_Version.UNDEFINED)
                {
                    MessageBox.Show("Could Not Find BMS");
                    Diagnostics.WriteLogFile();
                    Close();
                    return;
                }
            }
            catch (Exception ex005)
            {
                Diagnostics.WriteLogFile(ex005);
                Close();
                return;
            }

            try
            {
                if (DownloadWindow.CheckMinorUpdate(appReg))
                {
                    UPDATE_AVAILABLE.Visibility = Visibility.Hidden;
                }
                else
                {
                    UPDATE_AVAILABLE.Visibility = Visibility.Visible;
                    DownloadWindow.ShowDownloadWindow(this, appReg, ListBox_BMS);
                }
            }
            catch (Exception ex006)
            {
                Diagnostics.WriteLogFile(ex006);
                Close();
                return;
            }

            try
            {
                // Set Timer
                AxisMovingTimer.Tick    += AxisMovingTimer_Tick;
                AxisMovingTimer.Interval = new TimeSpan(0, 0, 0, 0, 16);

                KeyMappingTimer.Tick    += KeyMappingTimer_Tick;
                KeyMappingTimer.Interval = new TimeSpan(0, 0, 0, 0, 32);

                NewDeviceDetectTimer.Tick    += NewDeviceDetectTimer_Tick;
                NewDeviceDetectTimer.Interval = new TimeSpan(0, 0, 0, 1, 0);

                NewDeviceDetectTimer.Start();
            }
            catch (Exception ex007)
            {
                Diagnostics.WriteLogFile(ex007);
                Close();
                return;
            }
        }