コード例 #1
0
        private static async Task RemFriends(long xuid)
        {
            using (var form =
                       new MsgBoxYesNo(
                           @"Are you sure you want to remove this friends ? Click ""Yes"" to continue, or ""No"" to cancel.")
                   )
            {
                var dr = form.ShowDialog();
                if (dr != DialogResult.OK)
                {
                    return;
                }
            }

            try
            {
                var response =
                    await Program.WebSocketApi.DoRemoveFriend(xuid);

                if (!response.Result)
                {
                    throw new Exception(response.Message);
                }

                MsgBox.ShowMessage(@"Friend removed with success", @"Celeste Fan Project",
                                   MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MsgBox.ShowMessage($@"Error: {ex.Message}", @"Celeste Fan Project",
                                   MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        /// <summary>
        /// Close application when user click to quit menu
        /// </summary>
        public void CloseWin()
        {
            MsgBoxYesNo msgbox = new MsgBoxYesNo("Êtes vous certain de vouloir quitter le jeu?");

            if ((bool)msgbox.ShowDialog())
            {
                Application.Current.Shutdown();
            }
        }
コード例 #3
0
 private void btnCmdsHc05_Click(object sender, RoutedEventArgs e)
 {
     if (MsgBoxYesNo.ShowBox(
             this, DI.Wrapper.GetText(MsgCode.Create),
             string.Format("{0} (HC-05)", DI.Wrapper.GetText(MsgCode.commands))) == MsgBoxYesNo.MsgBoxResult.Yes)
     {
         this.IsChanged = true;
         DI.Wrapper.CreateHC05AtCmds(this.Close, App.ShowMsg);
     }
 }
コード例 #4
0
 private void btnArduino_Click(object sender, RoutedEventArgs e)
 {
     if (MsgBoxYesNo.ShowBox(
             this, DI.Wrapper.GetText(MsgCode.Create),
             string.Format("{0} (Arduino)", DI.Wrapper.GetText(MsgCode.Terminators))) == MsgBoxYesNo.MsgBoxResult.Yes)
     {
         this.IsChanged = true;
         DI.Wrapper.CreateArduinoTerminators(this.Close, App.ShowMsg);
     }
 }
コード例 #5
0
 /// <summary>Open a custom message box centered on caller</summary>
 /// <param name="win">The window opening the message box</param>
 /// <param name="title">The text to show on title bar</param>
 /// <param name="msg">The message to display</param>
 public static MsgBoxResult ShowMsgBoxYesNo(this Window win, string title, string msg, bool suppressContinue = false)
 {
     try {
         return(MsgBoxYesNo.ShowBox(win, title, msg, suppressContinue));
     }
     catch (Exception e) {
         LOG.Exception(9999, "ShowMsgBoxYesNo", "", e);
         return(MsgBoxResult.No);
     }
 }
コード例 #6
0
 public static bool ShowAreYouSure(string title, string msg)
 {
     return(STATIC_APP.DispatchProxy(() => {
         try {
             return MsgBoxYesNo.ShowBox(title, msg) == MsgBoxYesNo.MsgBoxResult.Yes;
         }
         catch (Exception) {
             return false;
         }
     }));
 }
コード例 #7
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            var item = this.lbxCmds.SelectedItem as IIndexItem <BLECmdIndexExtraInfo>;

            if (item != null)
            {
                if (MsgBoxYesNo.ShowBoxDelete(this, item.Display) == MsgBoxYesNo.MsgBoxResult.Yes)
                {
                    DI.Wrapper.DeleteBLECmdSet(item, this.ReloadList, App.ShowMsg);
                }
            }
        }
コード例 #8
0
        private void PictureBoxButtonCustom3_Click(object sender, EventArgs e)
        {
            _folderListener.EnableRaisingEvents = false;
            try
            {
                if (listView1.SelectedItems.Count < 1)
                {
                    return;
                }
                foreach (ListViewItem lvi in listView1.SelectedItems)
                {
                    try
                    {
                        if (File.Exists((string)lvi.Tag))
                        {
                            using (var form =
                                       new MsgBoxYesNo(
                                           $@"Are you sure to want to remove ""{
                                            lvi.Text
                                        }"" ? Click ""Yes"" to remove it, or ""No"" to cancel.")
                                   )
                            {
                                var dr = form.ShowDialog();
                                if (dr != DialogResult.OK)
                                {
                                    return;
                                }
                            }
                        }

                        File.Delete((string)lvi.Tag);
                    }
                    catch (Exception)
                    {
                        //
                    }
                }
                RefreshList();
            }
            catch (Exception)
            {
                //
            }
            finally
            {
                _folderListener.EnableRaisingEvents = true;
            }
        }
コード例 #9
0
        private void btnUnpair_Click(object sender, RoutedEventArgs e)
        {
            BTDeviceInfo device = BTSelect.ShowBox(this, true);

            if (device != null)
            {
                var result = MsgBoxYesNo.ShowBox(
                    this, DI.Wrapper.GetText(LanguageFactory.Net.data.MsgCode.Unpair), device.Name);
                if (result == MsgBoxYesNo.MsgBoxResult.Yes)
                {
                    this.gridWait.Show();
                    DI.Wrapper.BT_UnPairStatus -= this.unPairStatusHandler;
                    DI.Wrapper.BT_UnPairStatus += this.unPairStatusHandler;
                    DI.Wrapper.BTClassicUnPairAsync(device);
                }
            }
        }
コード例 #10
0
        /// <summary>
        /// Shows a custom message box dialog.
        /// </summary>
        /// <param name="title">Title of the custom message box.</param>
        /// <param name="message">Message for the custom message box.</param>
        /// <param name="icon">Icon for the bitmap image (e.g., SystemIcons.Error, SystemIcons.Warning, SystemIcons.Information).</param>
        /// <param name="dialogButtons">Type of buttons to use for the custom message box.</param>
        /// <param name="doNotWarnAgain">User preference for not warning again with a dialog (i.e., no longer show the dialog).</param>
        /// <returns>DialogResult.</returns>
        internal static DialogResult ShowMessage(string title, string message, Icon icon, DialogButtons dialogButtons, bool doNotWarnAgain = false)
        {
            var          dialogTitle   = title;
            var          dialogMessage = message;
            var          dialogIcon    = icon.ToBitmap();
            DialogResult result;

            switch (dialogButtons)
            {
            case DialogButtons.OK:
                using (var messageBox = new MsgBoxOk(dialogTitle, dialogMessage, dialogIcon))
                {
                    result = messageBox.ShowDialog();
                }

                break;

            case DialogButtons.YesNo:
                using (var messageBox = new MsgBoxYesNo(dialogTitle, dialogMessage, dialogIcon))
                {
                    result = messageBox.ShowDialog();
                }

                break;

            case DialogButtons.YesNoIgnore:
                using (var messageBox = new MsgBoxYesNoIgnore(doNotWarnAgain, dialogTitle, dialogMessage, dialogIcon))
                {
                    result         = messageBox.ShowDialog();
                    DoNotWarnAgain = messageBox.DoNotWarnAgain;
                }

                break;

            default:
                using (var messageBox = new MsgBoxOk(dialogTitle, dialogMessage, dialogIcon))
                {
                    result = messageBox.ShowDialog();
                }

                break;
            }

            return(result);
        }
コード例 #11
0
        private void EnableDiagnosticModeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Program.UserConfig.IsDiagnosticMode = !Program.UserConfig.IsDiagnosticMode;

            if (Program.UserConfig.IsDiagnosticMode)
            {
                try
                {
                    var procdumpFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "procdump.exe");
                    if (!File.Exists(procdumpFileName))
                    {
                        using (var form =
                                   new MsgBoxYesNo(
                                       "ProcDump.exe need to be installed first. Click \"Yes\" to install it, or \"No\" to cancel.\r\n" +
                                       "(https://docs.microsoft.com/en-us/sysinternals/downloads/procdump)"
                                       )
                               )
                        {
                            var dr = form.ShowDialog();
                            if (dr == DialogResult.OK)
                            {
                                using (var form2 = new InstallProcDump())
                                {
                                    form2.ShowDialog();
                                }
                            }
                            else
                            {
                                Program.UserConfig.IsDiagnosticMode = false;
                            }
                        }
                    }
                }
                catch (Exception exception)
                {
                    Program.UserConfig.IsDiagnosticMode = false;
                    MsgBox.ShowMessage(
                        $"Warning: Failed to enable \"Diagnostic Mode\". Error message: {exception.Message}",
                        @"Celeste Fan Project",
                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            UpdateDiagModeToolStripFromConfig();
        }
コード例 #12
0
 private void pairInfoRequested(object sender, BT_PairingInfoDataModel info)
 {
     this.Dispatcher.Invoke(() => {
         this.gridWait.Collapse();
         if (info.IsPinRequested)
         {
             var result = MsgBoxEnterText.ShowBox(
                 this, info.RequestTitle, info.RequestMsg);
             info.PIN = result.Text;
             info.HasUserConfirmed =
                 (result.Result == MsgBoxEnterText.MsgBoxTextInputResult.OK);
         }
         else
         {
             MsgBoxYesNo.MsgBoxResult result2 =
                 MsgBoxYesNo.ShowBox(this, info.RequestMsg, info.RequestMsg);
             info.HasUserConfirmed = (result2 == MsgBoxYesNo.MsgBoxResult.Yes);
         }
     });
 }
コード例 #13
0
        /// <summary>
        /// Action roll dice for player
        /// </summary>
        public void RollDice()
        {
            turnCount++;

            // Roll dice process
            int roll1 = DieOne.Roll();
            int roll2 = DieSecond.Roll();

            int sum = roll1 + roll2;

            doPlayAgain = roll1 == roll2;

            // If number are the same player can re-roll dices
            if (doPlayAgain)
            {
                InfoBulle = "Double, Relancez!!";

                Reader(infoBulle);

                doubleDiceCount++;

                if (doubleDiceCount >= 3)
                {
                    //TODO send player to jail

                    SetNextPlayerTurn();
                }
            }
            else
            {
                InfoBulle = "Avancez de " + sum + " cases";
                Reader(infoBulle);

                SetNextPlayerTurn();
            }

            // Move
            AbstractCase currentCase = Cases[CurrentPlayer.CurrentCaseIndex];

            CurrentPlayer.CurrentCaseIndex = CalculateNextCase(CurrentPlayer.CurrentCaseIndex, sum);
            AbstractCase nextCase = Cases[CurrentPlayer.CurrentCaseIndex];

            currentCase.Players.Remove(CurrentPlayer);
            nextCase.Players.Add(CurrentPlayer);

            // Execute case action
            string result = nextCase.Action(CurrentPlayer, (Platter)Model);

            if (nextCase.GetType() == typeof(PropertyCase) || nextCase.GetType() == typeof(StationCase))
            {
                MsgBoxYesNo msgbox = new MsgBoxYesNo(result);
                if ((bool)msgbox.ShowDialog())
                {
                    // Todo Buy property
                }
            }
            else
            {
                new MsgBoxOk(result).ShowDialog();
            }
        }
コード例 #14
0
        public static async void StartGame(bool isOffline = false)
        {
            var pname = Process.GetProcessesByName("spartan");

            if (pname.Length > 0)
            {
                MsgBox.ShowMessage(@"Game already running!");
                return;
            }

            //QuickGameScan
            if (!isOffline || InternetUtils.IsConnectedToInternet())
            {
                try
                {
                    var gameFilePath = !string.IsNullOrWhiteSpace(Program.UserConfig.GameFilesPath)
                        ? Program.UserConfig.GameFilesPath
                        : GameScannerManager.GetGameFilesRootPath();

                    using (var gameScannner = new GameScannerManager(gameFilePath, Program.UserConfig.IsSteamVersion))
                    {
                        await gameScannner.InitializeFromCelesteManifest();

retry:
                        if (!await gameScannner.Scan(true))
                        {
                            bool success;
                            using (var form =
                                       new MsgBoxYesNo(
                                           @"Error: Your game files are corrupted or outdated. Click ""Yes"" to run a ""Game Scan"" to fix your game files, or ""No"" to ignore the error (not recommended).")
                                   )
                            {
                                var dr = form.ShowDialog();
                                if (dr == DialogResult.OK)
                                {
                                    using (var form2 = new GameScan())
                                    {
                                        form2.ShowDialog();
                                        success = false;
                                    }
                                }
                                else
                                {
                                    success = true;
                                }
                            }
                            if (!success)
                            {
                                goto retry;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MsgBox.ShowMessage(
                        $"Warning: Error during quick scan. Error message: {ex.Message}",
                        @"Celeste Fan Project",
                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            //isSteam
            if (!Program.UserConfig.IsSteamVersion)
            {
                var steamApiDll = Path.Combine(Program.UserConfig.GameFilesPath, "steam_api.dll");
                if (File.Exists(steamApiDll))
                {
                    File.Delete(steamApiDll);
                }
            }

            //MpSettings
            if (!isOffline && Program.UserConfig.MpSettings != null)
            {
                if (Program.UserConfig.MpSettings.ConnectionType == ConnectionType.Wan)
                {
                    Program.UserConfig.MpSettings.PublicIp = Program.CurrentUser.Ip;

                    if (Program.UserConfig.MpSettings.PortMappingType == PortMappingType.Upnp)
                    {
                        try
                        {
                            await OpenNat.MapPortTask(1000, 1000);
                        }
                        catch (Exception)
                        {
                            Program.UserConfig.MpSettings.PortMappingType = PortMappingType.NatPunch;

                            MsgBox.ShowMessage(
                                "Error: Upnp device not found! \"UPnP Port Mapping\" has been disabled.",
                                @"Celeste Fan Project",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
コード例 #15
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            //CleanUpFiles
            try
            {
                Misc.CleanUpFiles(Directory.GetCurrentDirectory(), "*.old");
            }
            catch (Exception ex)
            {
                MsgBox.ShowMessage(
                    $"Warning: Error during files clean-up. Error message: {ex.Message}",
                    @"Celeste Fan Project",
                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            if (!InternetUtils.IsConnectedToInternet())
            {
                return;
            }

            //Update Check
            try
            {
                if (await Updater.GetGitHubVersion() > Assembly.GetExecutingAssembly().GetName().Version)
                {
                    using (var form =
                               new MsgBoxYesNo(
                                   @"An update is avalaible. Click ""Yes"" to install it, or ""No"" to ignore it (not recommended).")
                           )
                    {
                        var dr = form.ShowDialog();
                        if (dr == DialogResult.OK)
                        {
                            using (var form2 = new UpdaterForm())
                            {
                                form2.ShowDialog();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MsgBox.ShowMessage(
                    $"Warning: Error during update check. Error message: {ex.Message}",
                    @"Celeste Fan Project",
                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            //Auto Login
            if (Program.UserConfig?.LoginInfo == null)
            {
                return;
            }

            if (!Program.UserConfig.LoginInfo.AutoLogin)
            {
                return;
            }

            panelManager1.Enabled = false;
            try
            {
                var response = await Program.WebSocketApi.DoLogin(Program.UserConfig.LoginInfo.Email,
                                                                  Program.UserConfig.LoginInfo.Password);

                if (response.Result)
                {
                    Program.CurrentUser = response.User;

                    gamerCard1.UserName = Program.CurrentUser.ProfileName;
                    gamerCard1.Rank     = $@"{Program.CurrentUser.Rank}";

                    panelManager1.SelectedPanel = managedPanel1;
                }
            }
            catch (Exception)
            {
                //
            }
            panelManager1.Enabled = true;
        }
コード例 #16
0
 private bool DeleteDecision(string portName)
 {
     return(MsgBoxYesNo.ShowBoxDelete(this, portName) == MsgBoxYesNo.MsgBoxResult.Yes);
 }
コード例 #17
0
        private async void Btn_Play_Click(object sender, EventArgs e)
        {
            btn_Play.Enabled = false;
            var pname = Process.GetProcessesByName("spartan");

            if (pname.Length > 0)
            {
                MsgBox.ShowMessage(@"Game already running!");
                btn_Play.Enabled = true;
                return;
            }

            //QuickGameScan
            try
            {
                var gameFilePath = !string.IsNullOrWhiteSpace(Program.UserConfig.GameFilesPath)
                    ? Program.UserConfig.GameFilesPath
                    : GameScannnerApi.GetGameFilesRootPath();

                var gameScannner = new GameScannnerApi(gameFilePath, Program.UserConfig.IsSteamVersion,
                                                       Program.UserConfig.IsLegacyXLive);

retry:
                if (!await gameScannner.QuickScan())
                {
                    bool success;
                    using (var form =
                               new MsgBoxYesNo(
                                   @"Error: Your game files are corrupted or outdated. Click ""Yes"" to run a ""Game Scan"" to fix your game files, or ""No"" to ignore the error (not recommended).")
                           )
                    {
                        var dr = form.ShowDialog();
                        if (dr == DialogResult.OK)
                        {
                            using (var form2 = new GameScan())
                            {
                                form2.ShowDialog();
                                success = false;
                            }
                        }
                        else
                        {
                            success = true;
                        }
                    }
                    if (!success)
                    {
                        goto retry;
                    }
                }
            }
            catch (Exception ex)
            {
                MsgBox.ShowMessage(
                    $"Warning: Error during quick scan. Error message: {ex.Message}",
                    @"Celeste Fan Project",
                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            //isSteam
            if (!Program.UserConfig.IsSteamVersion)
            {
                var steamApiDll = $"{Program.UserConfig.GameFilesPath}\\steam_api.dll";
                if (File.Exists(steamApiDll))
                {
                    File.Delete(steamApiDll);
                }
            }

            //MpSettings
            try
            {
                if (Program.UserConfig.MpSettings != null)
                {
                    if (Program.UserConfig.MpSettings.IsOnline)
                    {
                        Program.UserConfig.MpSettings.PublicIp = Program.CurrentUser.Ip;

                        if (Program.UserConfig.MpSettings.AutoPortMapping)
                        {
                            var mapPortTask = OpenNat.MapPortTask(1000, 1000);
                            try
                            {
                                await mapPortTask;
                                NatDiscoverer.TraceSource.Close();
                            }
                            catch (AggregateException ex)
                            {
                                NatDiscoverer.TraceSource.Close();

                                if (!(ex.InnerException is NatDeviceNotFoundException))
                                {
                                    throw;
                                }

                                MsgBox.ShowMessage(
                                    "Error: Upnp device not found! Set \"Port mapping\" to manual in \"Mp Settings\" and configure your router.",
                                    @"Celeste Fan Project",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                                btn_Play.Enabled = true;

                                return;
                            }
                        }
                    }
                }
            }
            catch
            {
                MsgBox.ShowMessage(
                    "Error: Upnp device not found! Set \"Port mapping\" to manual in \"Mp Settings\" and configure your router.",
                    @"Celeste Fan Project",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                btn_Play.Enabled = true;

                return;
            }

            try
            {
                //Save UserConfig
                Program.UserConfig.Save(Program.UserConfigFilePath);
            }
            catch
            {
                //
            }

            try
            {
                //Launch Game
                var path = !string.IsNullOrEmpty(Program.UserConfig.GameFilesPath)
                    ? Program.UserConfig.GameFilesPath
                    : GameScannnerApi.GetGameFilesRootPath();

                if (!path.EndsWith(Path.DirectorySeparatorChar.ToString()))
                {
                    path += Path.DirectorySeparatorChar;
                }

                var spartanPath = Path.Combine(path, "Spartan.exe");

                if (!File.Exists(spartanPath))
                {
                    throw new FileNotFoundException("Spartan.exe not found!", spartanPath);
                }

                string lang;
                switch (Program.UserConfig.GameLanguage)
                {
                case GameLanguage.deDE:
                    lang = "de-DE";
                    break;

                case GameLanguage.enUS:
                    lang = "en-US";
                    break;

                case GameLanguage.esES:
                    lang = "es-ES";
                    break;

                case GameLanguage.frFR:
                    lang = "fr-FR";
                    break;

                case GameLanguage.itIT:
                    lang = "it-IT";
                    break;

                case GameLanguage.zhCHT:
                    lang = "zh-CHT";
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                try
                {
                    if (Program.UserConfig.IsDiagnosticMode)
                    {
                        var       procdumpFileName   = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "procdump.exe");
                        const int maxNumOfCrashDumps = 30;
                        if (!File.Exists(procdumpFileName))
                        {
                            throw new FileNotFoundException("Diagonstic Mode requires procdump.exe (File not Found)",
                                                            procdumpFileName);
                        }

                        // First ensure that all directories are set
                        var pathToCrashDumpFolder =
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                                         @"Spartan\MiniDumps");

                        if (!Directory.Exists(pathToCrashDumpFolder))
                        {
                            Directory.CreateDirectory(pathToCrashDumpFolder);
                        }

                        // Check for cleanup
                        Directory.GetFiles(pathToCrashDumpFolder)
                        .OrderByDescending(File.GetLastWriteTime) // Sort by age --> old one last
                        .Skip(maxNumOfCrashDumps)                 // Skip max num crash dumps
                        .ToList()
                        .ForEach(File.Delete);                    // Remove the rest

                        var excludeExceptions = new[]
                        {
                            "E0434F4D.COM", // .NET native exception
                            "E06D7363.msc",
                            "E06D7363.PAVEEFileLoadException@@",
                            "E0434F4D.System.IO.FileNotFoundException" // .NET managed exception
                        };

                        var excludeExcpetionsCmd = string.Join(" ", excludeExceptions.Select(elem => "-fx " + elem));

                        var fullCmdArgs = "-accepteula -mm -e 1 -n 10 " + excludeExcpetionsCmd +
                                          " -g -w Spartan.exe \"" + pathToCrashDumpFolder + "\"";

                        // MsgBox.ShowMessage(fullCmd);
                        var startInfo = new ProcessStartInfo(procdumpFileName, fullCmdArgs)
                        {
                            WorkingDirectory       = path,
                            CreateNoWindow         = true,
                            UseShellExecute        = false,
                            RedirectStandardError  = true,
                            RedirectStandardOutput = true
                        };

                        Process.Start(startInfo);
                    }
                }
                catch (Exception exception)
                {
                    MsgBox.ShowMessage(
                        $"Warning: {exception.Message}",
                        @"Celeste Fan Project",
                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                var arg = Program.UserConfig?.MpSettings == null || Program.UserConfig.MpSettings.IsOnline
                    ? $"--email \"{Program.UserConfig.LoginInfo.Email}\"  --password \"{Program.UserConfig.LoginInfo.Password}\" --ignore_rest LauncherLang={lang} LauncherLocale=1033"
                    : $"--email \"{Program.UserConfig.LoginInfo.Email}\"  --password \"{Program.UserConfig.LoginInfo.Password}\" --online-ip \"{Program.UserConfig.MpSettings.PublicIp}\" --ignore_rest LauncherLang={lang} LauncherLocale=1033";

                Process.Start(new ProcessStartInfo(spartanPath, arg)
                {
                    WorkingDirectory = path
                });

                WindowState = FormWindowState.Minimized;
            }
            catch (Exception exception)
            {
                MsgBox.ShowMessage(
                    $"Error: {exception.Message}",
                    @"Celeste Fan Project",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            btn_Play.Enabled = true;
        }
コード例 #18
0
        private void PictureBoxButtonCustom2_Click(object sender, EventArgs e)
        {
            _folderListener.EnableRaisingEvents = false;

            try
            {
                using (var dlg = new OpenFileDialog
                {
                    Filter = @"Scenario files (*.age4scn)|*.age4scn",
                    CheckFileExists = true,
                    Title = @"Choose Scenario File",
                    Multiselect = true
                })
                {
                    if (dlg.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }

                    foreach (var filename in dlg.FileNames)
                    {
                        var selectedDestinationPath =
                            Path.Combine(_scnPath, Path.GetFileName(filename) ?? string.Empty);
                        try
                        {
                            if (File.Exists(selectedDestinationPath))
                            {
                                using (var form =
                                           new MsgBoxYesNo(
                                               $@"The file already exist ""{
                                                selectedDestinationPath
                                            }"". Click ""Yes"" to overwrite it, or ""No"" to ignore it.")
                                       )
                                {
                                    var dr = form.ShowDialog();
                                    if (dr != DialogResult.OK)
                                    {
                                        return;
                                    }
                                }
                            }

                            File.Copy(filename, selectedDestinationPath, true);
                        }
                        catch (Exception)
                        {
                            //
                        }
                    }

                    RefreshList();
                }
            }
            catch (Exception)
            {
                //
            }
            finally
            {
                _folderListener.EnableRaisingEvents = true;
            }
        }