Exemple #1
0
        //Show monitor screen message
        private static void ShowFailedCaptureMessage()
        {
            try
            {
                AVActions.ActionDispatcherInvoke(async delegate
                {
                    List <string> MsgBoxAnswers = new List <string>();
                    MsgBoxAnswers.Add("Change monitor setting");
                    MsgBoxAnswers.Add("Change the led mode");
                    MsgBoxAnswers.Add("Retry to capture screen");
                    MsgBoxAnswers.Add("Close application");

                    string MsgBoxResult = await new AVMessageBox().Popup(null, "Failed to start capturing your monitor screen", "Please make sure the correct monitor screen is selected, Microsoft Visual C++ 2019 Redistributable is installed on your PC, that you have a 64bit Windows installation and that you have a DirectX 12 or higher capable graphics adapter installed.", MsgBoxAnswers);
                    if (MsgBoxResult == "Change monitor setting")
                    {
                        await LedSwitch(LedSwitches.Disable);
                        ShowSettings();
                    }
                    else if (MsgBoxResult == "Change the led mode")
                    {
                        await LedSwitch(LedSwitches.Disable);
                        ShowSettings();
                    }
                    else if (MsgBoxResult == "Retry to capture screen")
                    {
                        await LedSwitch(LedSwitches.Restart);
                    }
                    else if (MsgBoxResult == "Close application")
                    {
                        await AppStartup.Application_Exit();
                    }
                });
            }
            catch { }
        }
Exemple #2
0
        //Show device connection message
        private static void ShowFailedConnectionMessage()
        {
            try
            {
                AVActions.ActionDispatcherInvoke(async delegate
                {
                    List <string> MsgBoxAnswers = new List <string>();
                    MsgBoxAnswers.Add("Change com port");
                    MsgBoxAnswers.Add("Retry to connect");
                    MsgBoxAnswers.Add("Close application");

                    string MsgBoxResult = await new AVMessageBox().Popup(null, "Failed to connect to your com port device", "Please make sure the device is not in use by another application, the correct com port is selected and that the required drivers are installed on your system.", MsgBoxAnswers);
                    if (MsgBoxResult == "Change com port")
                    {
                        await LedSwitch(LedSwitches.Disable);
                        ShowSettings();
                    }
                    else if (MsgBoxResult == "Retry to connect")
                    {
                        await LedSwitch(LedSwitches.Restart);
                    }
                    else if (MsgBoxResult == "Close application")
                    {
                        await AppStartup.Application_Exit();
                    }
                });
            }
            catch { }
        }
Exemple #3
0
 private static async void OnExit(object sender, EventArgs e)
 {
     try
     {
         await AppStartup.Application_Exit();
     }
     catch { }
 }
Exemple #4
0
        protected override async void OnStartup(StartupEventArgs e)
        {
            try
            {
                //Allow application in firewall
                string appFilePath = Assembly.GetEntryAssembly().Location;
                Firewall_ExecutableAllow("AmbiPro", appFilePath, true);

                AppStartup AppStartup = new AppStartup();
                await AppStartup.Application_Startup();
            }
            catch { }
        }
Exemple #5
0
        //Check for available application update
        public static async Task CheckForAppUpdate(bool Silent)
        {
            try
            {
                if (!vCheckingForUpdate)
                {
                    vCheckingForUpdate = true;

                    string onlineVersion = await ApiGitHub_GetLatestVersion("dumbie", "AmbiPro");

                    string currentVersion = "v" + Assembly.GetEntryAssembly().FullName.Split('=')[1].Split(',')[0];
                    if (!string.IsNullOrWhiteSpace(onlineVersion) && onlineVersion != currentVersion)
                    {
                        List <string> MsgBoxAnswers = new List <string>();
                        MsgBoxAnswers.Add("Update");
                        MsgBoxAnswers.Add("Cancel");

                        string MsgBoxResult = await new AVMessageBox().Popup(null, "A newer version has been found: " + onlineVersion, "Would you like to update the application to the newest version available?", MsgBoxAnswers);
                        if (MsgBoxResult == "Update")
                        {
                            await ProcessLauncherWin32Async("Updater.exe", "", "", false, false);

                            await AppStartup.Application_Exit();
                        }
                    }
                    else
                    {
                        if (!Silent)
                        {
                            List <string> MsgBoxAnswers = new List <string>();
                            MsgBoxAnswers.Add("Ok");

                            await new AVMessageBox().Popup(null, "No new application update has been found.", "", MsgBoxAnswers);
                        }
                    }

                    vCheckingForUpdate = false;
                }
            }
            catch
            {
                vCheckingForUpdate = false;
                if (!Silent)
                {
                    List <string> MsgBoxAnswers = new List <string>();
                    MsgBoxAnswers.Add("Ok");

                    await new AVMessageBox().Popup(null, "Failed to check for the latest application version", "Please check your internet connection and try again.", MsgBoxAnswers);
                }
            }
        }