private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            FolderBrowserDialog ofd = new FolderBrowserDialog();
            DialogResult result = ofd.ShowDialog();

            if (result == DialogResult.OK)
            {
                baseDirectoryName = ofd.SelectedPath;
                baseDirectoryLabel.Content = baseDirectoryName;
            }
        }
 private void cmdBrowse_Click( object sender, EventArgs e ) {
     FolderBrowserDialog dlg = new FolderBrowserDialog();
     DialogResult res = dlg.ShowDialog();
     if( res == System.Windows.Forms.DialogResult.OK ) {
         txtPath.Text = dlg.SelectedPath;
     }
 }
Example #3
0
        private void browse_Click(object sender, EventArgs e)
        {
            //FileDialogs do not work well on Vista
            bool useClassicFolderBrowser = IsVistaOrHigher();
            if (useClassicFolderBrowser)
            {
                using (FolderBrowserDialog browse = new FolderBrowserDialog())
                {
                    browse.Description = "Select CS-Script search directorty to add.";
                    browse.SelectedPath = textBox1.Text;

                    if (browse.ShowDialog() == DialogResult.OK)
                        textBox1.Text = browse.SelectedPath;
                }
            }
            else
            {
                using (FileDialogs.SelectFolderDialog dialog = new FileDialogs.SelectFolderDialog())
                {
                    if (DialogResult.OK == dialog.ShowDialog())
                    {
                        if (dialog.SelectedPath != "")
                            textBox1.Text = dialog.SelectedPath;
                    }
                }
            }
        }
Example #4
0
        private void linkLabel1_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e)
        {
            FolderBrowserDialog fd = new FolderBrowserDialog();
            fd.Description = "Select a `parent' folder of projects.\r\nRepository folders are located under the folder you select via this window.";
            fd.SelectedPath = parent.basepath;
            if (fd.ShowDialog() == DialogResult.OK)
            {
                /*GitJobParameters p = new GitJobParameters();
                p.dir = parent.curdir;
                p.toadd = parent.toadd;
                p.tochange = parent.tochange;
                p.toremove = parent.toremove;*/

                parent.jobman.ExecuteAllJobs();

                //parent.git.StartCommitChanges(p);
                parent.basepath = fd.SelectedPath;
                if (parent.basepath.Substring(parent.basepath.Length - 1) != "\\")
                    parent.basepath += "\\";
                parent.fsw.Path = parent.basepath;
                this.textBox1.Text = parent.basepath;

                parent.jobman = new JobManager(parent, parent.basepath);
                parent.RefreshList();
            }
        }
Example #5
0
        private static bool GetManualInstallationPath(out string installationPath)
        {
            string gnomoriaPath = "";
            installationPath = null;
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
            }
            while (!File.Exists(gnomoriaPath))
            {
                using (FolderBrowserDialog fbd = new FolderBrowserDialog
                {
                    Description = "Gnomoria installation folder (containing Gnomoria.exe)",
                    ShowNewFolderButton = false
                })
                {
                    if (fbd.ShowDialog() != DialogResult.OK)
                    {
                        return false;
                    }

                    installationPath = Settings.Default.GnomoriaInstallationPath = fbd.SelectedPath;
                    gnomoriaPath = Path.Combine(installationPath, Reference.OriginalExecutable);
                }
                Settings.Default.Save();
            }
            return true;
        }
        /// <summary>
        /// This function is the callback used to execute a command when the a menu item is clicked.
        /// See the Initialize method to see how the menu item is associated to this function using
        /// the OleMenuCommandService service and the MenuCommand class.
        /// </summary>
        private void MenuItemCallback(object sender, EventArgs e)
        {
            //MessageBox.Show("Not finished yet.");
            FolderBrowserDialog fbd = new FolderBrowserDialog();
            fbd.SelectedPath = "D:/";
            if (fbd.ShowDialog() == DialogResult.OK)
            {
                ImageCatchManager.Instance.SetDirPath(fbd.SelectedPath);
            }

            //// Show a Message Box to prove we were here
            //IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell));
            //Guid clsid = Guid.Empty;
            //int result;
            //Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(uiShell.ShowMessageBox(
            //           0,
            //           ref clsid,
            //           "VSBackGroundPackage",
            //           string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.ToString()),
            //           string.Empty,
            //           0,
            //           OLEMSGBUTTON.OLEMSGBUTTON_OK,
            //           OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST,
            //           OLEMSGICON.OLEMSGICON_INFO,
            //           0,        // false
            //           out result));
        }
Example #7
0
 internal DialogResult ShowDialog(IWin32Window owner)
 {
     FolderBrowserDialog dialog = new FolderBrowserDialog();
     DialogResult result = dialog.ShowDialog();
     Folder = dialog.SelectedPath;
     dialog.Dispose();
     return result;
 }
Example #8
0
    void OnClicked(object sender, ToolBarButtonClickEventArgs e)
    {
        FolderBrowserDialog dialog = new FolderBrowserDialog();

           if (dialog.ShowDialog(this) == DialogResult.OK) {
           statusbar.Text = dialog.SelectedPath;
           }
    }
 private void button3_Click(object sender, RoutedEventArgs e)
 {
     FolderBrowserDialog openFolderDlg = new FolderBrowserDialog();
     openFolderDlg.ShowDialog();
     if (openFolderDlg.SelectedPath != string.Empty)
         outputpath = openFolderDlg.SelectedPath;
     this.textBox2.Text = outputpath;
 }
Example #10
0
 private void OnClickMasterInstallerBrowse(object sender, EventArgs e)
 {
     var d = new FolderBrowserDialog();
     d.Description = "Select the folder that contains your local copy of the Master Installer source files:";
     d.SelectedPath = MasterInstallerFolderBox.Text;
     d.ShowNewFolderButton = false;
     d.ShowDialog();
     MasterInstallerFolderBox.Text = d.SelectedPath;
 }
 public void Execute(CoroutineExecutionContext context)
 {
     var dialog = new FolderBrowserDialog();
     if(!String.IsNullOrEmpty(SelectedFolder))
         dialog.SelectedPath = SelectedFolder;
     var result = dialog.ShowDialog();
     SelectedFolder = dialog.SelectedPath;
     Completed(this, new ResultCompletionEventArgs { WasCancelled = result != DialogResult.OK });
 }
Example #12
0
 private void btnBrowseForFolder_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog fbd = new FolderBrowserDialog();
     fbd.Description = "Select a folder for saving this file ";
     if (fbd.ShowDialog() == DialogResult.OK)
     {
         txtCurrentLocation.Text = fbd.SelectedPath;
     }
 }
 private void btnEditFolder_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     FolderBrowserDialog folder = new FolderBrowserDialog();
     DialogResult result = folder.ShowDialog();
     if (result == DialogResult.OK)
     {
         btnEditFolder.Text = folder.SelectedPath;
     }
 }
Example #14
0
 private void OnClickCDsBrowse(object sender, EventArgs e)
 {
     var d = new FolderBrowserDialog();
     d.Description = "Select the folder that does (or will) contain your local copy of the CD images archive:";
     d.SelectedPath = CdImagesFolderBox.Text;
     d.ShowNewFolderButton = true;
     d.ShowDialog();
     CdImagesFolderBox.Text = d.SelectedPath;
 }
Example #15
0
 private void buttonOpen_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog dialog = new FolderBrowserDialog();
     dialog.SelectedPath = textBoxWebClientPath.Text;
     if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         textBoxWebClientPath.Text = dialog.SelectedPath;
     }
 }
Example #16
0
 private void btnBrowseDir_Click(object sender, RoutedEventArgs e)
 {
     FolderBrowserDialog dialog = new FolderBrowserDialog {
         Description = "Select the directory containing PCSX2"
     };
     if (dialog.ShowDialog() == DialogResult.OK)
     {
         this.tbPcsx2Dir.Text = dialog.SelectedPath;
     }
 }
Example #17
0
        private void BT_FileOutput_Copy_Click(object sender, RoutedEventArgs e)
        {
            FolderBrowserDialog FBD = new FolderBrowserDialog();

            if (FBD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                ViewLeader.EncipheringView.FileOutput_Path = FBD.SelectedPath;
            }

        }
        private void conversion_folder_btn_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new FolderBrowserDialog();
            var result = dialog.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                pipeline.ConvertedFilesFolder = dialog.SelectedPath;
            }

        }
        private void download_folder_btn_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new FolderBrowserDialog();
            var result = dialog.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                pipeline.FolderPath = dialog.SelectedPath;
            }


        }
	public void BrowseGamedataPath(){
		System.Windows.Forms.FolderBrowserDialog FolderDialog = new FolderBrowserDialog ();

		FolderDialog.ShowNewFolderButton = false;
		FolderDialog.Description = "Select 'Gamedata' folder in Supreme Commander Forget Alliance instalation directory.";

		if (FolderDialog.ShowDialog() == DialogResult.OK)
		{
			PathField.text = FolderDialog.SelectedPath;
		}
	}
Example #21
0
        private void Browse(object sender, RoutedEventArgs e)
        {
            FolderBrowserDialog folderDialog = new FolderBrowserDialog();
            DialogResult result = folderDialog.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                string folderName = folderDialog.SelectedPath;
                FileNameTextBox.Text = folderName;
            }
        }
Example #22
0
        private void ChooseImagesDir_Click(object sender, RoutedEventArgs e)
        {
            var dlg = new FolderBrowserDialog();
            if (dlg.ShowDialog() == DialogResult.Cancel) return;

            App.Settings.ImagesDirectory = dlg.SelectedPath;
            App.Settings.Save();

            var world = (WorldModel)DataContext;
            world.ImagesDirectory = dlg.SelectedPath;
        }
Example #23
0
 private void button_find_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog folderDialog = new FolderBrowserDialog();
     if (folderDialog.ShowDialog() == DialogResult.OK)
     {
         path = folderDialog.SelectedPath;
         textbox_src.Text = path;
         fw.Path = path;
         rkey.SetValue("path", path);
     }
 }
Example #24
0
        public FileListDialog()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            m_fbd = new FolderBrowserDialog();
        }
Example #25
0
        private void btnBrowse_Click(object sender, RoutedEventArgs e)
        {
            var folderBrowseDialog = new FolderBrowserDialog();
            folderBrowseDialog.RootFolder = Environment.SpecialFolder.Desktop;

            if (folderBrowseDialog.ShowDialog() == DialogResult.OK)
            {
                Properties.Settings.Default.backupPath = folderBrowseDialog.SelectedPath + "\\isaac.db";
            }
            backupPath.Text = Properties.Settings.Default.backupPath;
            Properties.Settings.Default.Save();
        }
        private void buttonBrowseReportFolder_Click(object sender, RoutedEventArgs e)
        {
            using (var fileBrowseDialog = new FolderBrowserDialog())
            {
                fileBrowseDialog.Description = "Выбор пути к папке отчетов";

                if (fileBrowseDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    textBox2.Text = fileBrowseDialog.SelectedPath;
                }
            }
        }
	public void BrowseMapPath(){

		System.Windows.Forms.FolderBrowserDialog FolderDialog = new FolderBrowserDialog ();

		FolderDialog.ShowNewFolderButton = false;
		FolderDialog.Description = "Select 'Maps' folder.";

		if (FolderDialog.ShowDialog() == DialogResult.OK)
		{
			MapsPathField.text = FolderDialog.SelectedPath;
		}
	}
        private void BrowseDB_Button_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Controls.Button b = sender as System.Windows.Controls.Button;
            if (b.Name == "BrowseDB")
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.Title            = "Import Access Database";
                openFileDialog.Filter           = "MS Access (*.mdb *.accdb)|*.mdb;*.accdb";
                openFileDialog.RestoreDirectory = true;
                openFileDialog.ShowDialog();

                if (openFileDialog.FileName != "")
                {
                    txtBoxDB.Text = mDBPath = openFileDialog.FileName;
                    string bucketQuery = "SELECT Config.bucket FROM Config;";
                    string prefixQuery = "SELECT Config.prefix FROM Config;";
                    if (mDBPath != null)
                    {
                        string[] bucketArr = queryDB(bucketQuery, mDBPath);
                        string[] prefixArr = queryDB(prefixQuery, mDBPath);
                        if (bucketArr[0] != null || prefixArr[0] != null)
                        {
                            string            caption = "Error";
                            MessageBoxButtons buttons = MessageBoxButtons.OK;
                            System.Windows.Forms.MessageBox.Show(bucketArr[0], caption, buttons, MessageBoxIcon.Error);
                            bucketLabel.Content = $"Bucket: Error";
                        }
                        else
                        {
                            bucket = bucketArr[1];
                            prefix = prefixArr[1];
                            bucketLabel.Content = $"Bucket: {bucket}/{prefix}";
                        }
                    }
                }
            }
            else
            {
                if (TabItemWrite.IsSelected) //write
                {
                    FolderBrowserDialog browseFolderDialog = new FolderBrowserDialog();
                    browseFolderDialog.ShowDialog();
                    if (b.Name == "BrowseInput")
                    {
                        if (browseFolderDialog.SelectedPath != "")
                        {
                            txtBoxInput.Text = mInputPath = browseFolderDialog.SelectedPath;
                        }
                    }
                    else
                    {
                        if (browseFolderDialog.SelectedPath != "")
                        {
                            txtBoxOutput.Text = mOutputPath = browseFolderDialog.SelectedPath;
                            Upload.IsEnabled  = true;
                            Geotag.IsEnabled  = true;
                        }
                    }
                }
                else   //read
                {
                    if (b.Name == "BrowseInputRead")
                    {
                        FolderBrowserDialog browseFolderDialog = new FolderBrowserDialog();
                        browseFolderDialog.ShowDialog();
                        if (browseFolderDialog.SelectedPath != "")
                        {
                            txtInputPathRead.Text = mInputPath = browseFolderDialog.SelectedPath;
                        }
                    }
                    else
                    {
                        SaveFileDialog saveFileDialog1 = new SaveFileDialog();
                        saveFileDialog1.Filter = "csv files (*.csv)|*.csv|All files (*.*)|*.*";
                        saveFileDialog1.ShowDialog();
                        if (saveFileDialog1.FileName != "")
                        {
                            txtOutputPathRead.Text = mOutputPath = saveFileDialog1.FileName;
                        }
                    }
                }
            }
        }
        private void CheckSettings()
        {
            //Check if LOTDPath is set AND the LOTD .exe / .dat / .toc can be found.
            if (programSettings.LOTDPath == "" ||
                !CheckPathContainsFile(programSettings.LOTDPath, CONSTANTS.LOTD_DAT_FILENAME) ||
                !CheckPathContainsFile(programSettings.LOTDPath, CONSTANTS.LOTD_TOC_FILENAME))
            {
                //Path is wrong or not set, ask for re-enter
                FolderBrowserDialog fbd = new FolderBrowserDialog();
                fbd.SelectedPath = Environment.CurrentDirectory;
                fbd.Description  = "Choose your Yu-Gi-Oh: Legacy of the Duelist installation path! (Contains YuGiOh.exe, YGO_DATA.dat and YGO_DATA.toc)";
                fbd.ShowDialog();
                programSettings.LOTDPath = fbd.SelectedPath;
                if (programSettings.LOTDPath == "" ||
                    !CheckPathContainsFile(programSettings.LOTDPath, CONSTANTS.LOTD_DAT_FILENAME) ||
                    !CheckPathContainsFile(programSettings.LOTDPath, CONSTANTS.LOTD_TOC_FILENAME))
                {
                    TEMP_SETTINGS.CanExtractGame = true;
                }
            }
            else
            {
                LogOut("Yu-Gi-Oh: LOTD Path found: " + programSettings.LOTDPath);
                TEMP_SETTINGS.CanExtractGame = true;
            }
            programSettings.Save();

            //Check if SavePath is set AND the LOTD savegame.dat can be found.
            if (programSettings.LOTDSavePath == "" ||
                !File.Exists(programSettings.LOTDSavePath))
            {
            }
            else
            {
                LogOut("Yu-Gi-Oh: LOTD Save-Path found: " + programSettings.LOTDPath);
                TEMP_SETTINGS.CanExtractSave = true;
            }

            //Check if card_map.csv is there
            if (!CheckPathContainsFile("", CONSTANTS.CSV_MAP_FILENAME))
            {
                MessageBox.Show("Error: " + CONSTANTS.CSV_MAP_FILENAME + " is missing, but we definitely need that :(\nRedownload this tool, as that file should come with it!");
                Application.Exit();
            }
            else
            {
                LogOut("card_map.csv found!");
            }

            //Check if cards.cdb is there
            if (!CheckPathContainsFile("", CONSTANTS.CARD_DB_FILENAME))
            {
                MessageBox.Show("Error: " + CONSTANTS.CARD_DB_FILENAME + " is missing, but we definitely need that :(\nGet it from YGOPRO/redownload this tool and put it in the same folder as this program.");
                Application.Exit();
            }
            else
            {
                LogOut("cards.cdb found!");
            }

            //Check if cards_not_available is there
            if (!CheckPathContainsFile("", CONSTANTS.CARDS_NOT_AVAILABLE))
            {
                MessageBox.Show("Error: " + CONSTANTS.CARDS_NOT_AVAILABLE + " is missing, but we definitely need that or the game breaks with those cards :(\nRedownload this tool, as that file should come with it!");
                Application.Exit();
            }
            else
            {
                LogOut("card_map.csv found!");
            }

            //Check if PUT_YOUR_DECKS_HERE folder is there, otherwise create it
            if (!Directory.Exists(CONSTANTS.ADD_PACKS_FOLDER))
            {
                Directory.CreateDirectory(CONSTANTS.ADD_PACKS_FOLDER);
                LogOut("Created folder: " + CONSTANTS.ADD_PACKS_FOLDER);
            }
            else
            {
                LogOut("Folder " + CONSTANTS.ADD_PACKS_FOLDER + " found!");
            }

            //Check if DECK_DATABASE folder is there, otherwise create it
            if (!Directory.Exists(CONSTANTS.DECK_DATABASE))
            {
                Directory.CreateDirectory(CONSTANTS.DECK_DATABASE);
                LogOut("Created folder: " + CONSTANTS.DECK_DATABASE + " (Make sure that you put some .ydk/.ydc decks in there for AI deck shuffle!)");
            }
            else
            {
                LogOut("Folder " + CONSTANTS.DECK_DATABASE + " found!");
            }

            //Check if YGO_DATA working folder is there
            if (!Directory.Exists(CONSTANTS.YGO_DATA_WORKING_FOLDER))
            {
                //Directory.CreateDirectory(CONST_STRINGS.YGO_DATA_WORKING_FOLDER);
                LogOut("Error: Folder: " + CONSTANTS.YGO_DATA_WORKING_FOLDER + " not found - extract game data first!");
            }
            else
            {
                LogOut("Folder " + CONSTANTS.YGO_DATA_WORKING_FOLDER + " found!");
            }

            //Check if YGO_DATA working folder contains packs.zib
            if (!CheckPathContainsFile(CONSTANTS.YGO_DATA_WORKING_FOLDER, CONSTANTS.YGODATA_PACKS))
            {
                //Directory.CreateDirectory(CONST_STRINGS.YGO_DATA_WORKING_FOLDER);
                LogOut("Error: File: " + Path.Combine(CONSTANTS.YGO_DATA_WORKING_FOLDER, CONSTANTS.YGODATA_PACKS) + " not found - extract game data first!");
            }
            else
            {
                TEMP_SETTINGS.CanUnpackPacks = true;
                LogOut("File: " + Path.Combine(CONSTANTS.YGO_DATA_WORKING_FOLDER, CONSTANTS.YGODATA_PACKS) + " found!");
            }

            //Check if YGO_DATA working folder contains decks.zib
            if (!CheckPathContainsFile(CONSTANTS.YGO_DATA_WORKING_FOLDER, CONSTANTS.YGODATA_DECKS))
            {
                //Directory.CreateDirectory(CONST_STRINGS.YGO_DATA_WORKING_FOLDER);
                LogOut("Error: File: " + Path.Combine(CONSTANTS.YGO_DATA_WORKING_FOLDER, CONSTANTS.YGODATA_DECKS) + " not found - extract game data first!");
            }
            else
            {
                TEMP_SETTINGS.CanUnpackDecks = true;
                LogOut("File " + Path.Combine(CONSTANTS.YGO_DATA_WORKING_FOLDER, CONSTANTS.YGODATA_DECKS) + " found!");
            }

            if (TEMP_SETTINGS.CanUnpackDecks && TEMP_SETTINGS.CanUnpackPacks)
            {
                TEMP_SETTINGS.CanPackGame = true;
            }

            //Check if packs.zib working folder is there
            if (!Directory.Exists(CONSTANTS.YGODATA_PACKS + CONSTANTS.UNPACKED_SUFFIX))
            {
                //Directory.CreateDirectory(CONST_STRINGS.YGO_DATA_WORKING_FOLDER);
                LogOut("Error: Folder: " + CONSTANTS.YGODATA_PACKS + CONSTANTS.UNPACKED_SUFFIX + " not found - unpack " + CONSTANTS.YGODATA_PACKS + " first!");
            }
            else
            {
                TEMP_SETTINGS.CanPatchPacks = true;
                LogOut("Folder " + CONSTANTS.YGODATA_PACKS + CONSTANTS.UNPACKED_SUFFIX + " found!");
            }

            //Check if decks.zib working folder is there
            if (!Directory.Exists(CONSTANTS.YGODATA_DECKS + CONSTANTS.UNPACKED_SUFFIX))
            {
                //Directory.CreateDirectory(CONST_STRINGS.YGO_DATA_WORKING_FOLDER);

                LogOut("Error: Folder: " + CONSTANTS.YGODATA_DECKS + CONSTANTS.UNPACKED_SUFFIX + " not found - unpack " + CONSTANTS.YGODATA_DECKS + " first!");
            }
            else
            {
                TEMP_SETTINGS.CanPatchDecks = true;
                LogOut("Folder " + CONSTANTS.YGODATA_DECKS + CONSTANTS.UNPACKED_SUFFIX + " found!");
            }
            //Check if patched output working folder is there, otherwise create it
            if (!Directory.Exists(CONSTANTS.PATCHED_YGODATA_OUT_FOLDER))
            {
                Directory.CreateDirectory(CONSTANTS.PATCHED_YGODATA_OUT_FOLDER);
                LogOut("Created folder: " + CONSTANTS.PATCHED_YGODATA_OUT_FOLDER);
            }
            else
            {
                LogOut("Folder " + CONSTANTS.PATCHED_YGODATA_OUT_FOLDER + " found!");
            }

            //Check if patched output working folder is there, otherwise create it
            if (!CheckPathContainsFile(CONSTANTS.PATCHED_YGODATA_OUT_FOLDER, CONSTANTS.LOTD_DAT_FILENAME) ||
                !CheckPathContainsFile(CONSTANTS.PATCHED_YGODATA_OUT_FOLDER, CONSTANTS.LOTD_TOC_FILENAME))
            {
                //Directory.CreateDirectory(CONST_STRINGS.YGO_DATA_WORKING_FOLDER);
                LogOut("Error: Folder/Patched data files in: " + CONSTANTS.PATCHED_YGODATA_OUT_FOLDER + " not found - patch the modified files first!");
            }
            else
            {
                TEMP_SETTINGS.CanCopyToGame = true;
                LogOut("Patched deck/pack files in " + CONSTANTS.PATCHED_YGODATA_OUT_FOLDER + " found!");
            }

            //Check ChosenPacks/ChosenDecks
            if (programSettings.ChosenPacksDictionaryJSON != "")
            {
                ChosenPacks = JsonConvert.DeserializeObject <Dictionary <string, bool> >(programSettings.ChosenPacksDictionaryJSON);
            }

            UpdateChosenList(chkListBoxPacks, ChosenPacks, CONSTANTS.ADD_PACKS_FOLDER, "", false);
            programSettings.ChosenPacksDictionaryJSON = JsonConvert.SerializeObject(ChosenPacks);

            //Check ChosenPacks/ChosenDecks
            if (programSettings.ChosenDecksDictionaryJSON != "")
            {
                ChosenDecks = JsonConvert.DeserializeObject <Dictionary <string, bool> >(programSettings.ChosenDecksDictionaryJSON);
            }

            UpdateChosenList(chkListBoxDecks, ChosenDecks, CONSTANTS.DECK_DATABASE, "", false);
            programSettings.ChosenDecksDictionaryJSON = JsonConvert.SerializeObject(ChosenDecks);

            chkOnlyShowChosenDecks.Checked = programSettings.ShowOnlyCheckedDecks;
            chkOnlyShowChosenPacks.Checked = programSettings.ShowOnlyCheckedPacks;
            chkJSONRarity.Checked          = programSettings.SimulateRarity;
        }
Example #30
0
        private void ButtonClicked(object sender, EventArgs e)
        {
            if (sender == null)
            {
                return;
            }
            if (sender is Button)
            {
                Button button = (Button)sender;
                if (button.Tag == null)
                {
                    return;
                }
                // Handle a PreferenceList
                if (button.Tag is PreferenceListDetails)
                {
                    PreferenceListDetails details = (PreferenceListDetails)button.Tag;
                    if (details.ListBox.SelectedIndex != -1)
                    {
                        sbyte indexChange;
                        if (button == details.ButtonUp)
                        {
                            indexChange = -1; // one up
                        }
                        else if (button == details.ButtonDown)
                        {
                            indexChange = 1; // one down
                        }
                        else
                        {
                            return; // wrong button?
                        }
                        int selectedIndex = details.ListBox.SelectedIndex;
                        int itemIndex     = details.PreferenceList.Ranking[selectedIndex];
                        details.PreferenceList.Ranking.RemoveAt(selectedIndex);
                        details.PreferenceList.Ranking.Insert(selectedIndex + indexChange, itemIndex);
                        string itemString = details.ListBox.SelectedItem.ToString();
                        details.ListBox.Items.RemoveAt(selectedIndex);
                        details.ListBox.Items.Insert(selectedIndex + indexChange, itemString);
                        details.ListBox.SelectedIndex = selectedIndex + indexChange;
                        _btnSave.Enabled  = true;
                        _btnApply.Enabled = true;
                    }
                }
                // Handle a Path
                else if (button.Tag is PathDetails)
                {
                    PathDetails details = (PathDetails)button.Tag;
                    switch (details.Path.SelectedPathType)
                    {
                    case Path.PathType.FILE:
                        OpenFileDialog ofd = new OpenFileDialog();
                        ofd.FileName = details.Path.SelectedPath;
                        if (System.IO.File.Exists(ofd.FileName))
                        {
                            ofd.InitialDirectory = System.IO.Path.GetDirectoryName(ofd.FileName);
                        }
                        if (ofd.ShowDialog() == DialogResult.OK)
                        {
                            details.TextBox.Text      = ofd.FileName;
                            details.Path.SelectedPath = ofd.FileName;
                            _btnSave.Enabled          = true;
                            _btnApply.Enabled         = true;
                        }
                        break;

                    case Path.PathType.FOLDER:
                        FolderBrowserDialog fbd = new FolderBrowserDialog();
                        fbd.SelectedPath = details.Path.SelectedPath;
                        if (fbd.ShowDialog() == DialogResult.OK)
                        {
                            details.TextBox.Text      = fbd.SelectedPath;
                            details.Path.SelectedPath = fbd.SelectedPath;
                            _btnSave.Enabled          = true;
                            _btnApply.Enabled         = true;
                        }
                        break;

                    default:
                        return;
                    }
                }
            }
        }
        private void deJargonizeBtn_Click(object sender, EventArgs e)
        {
            progressBar.Visible = true;
            progressBar.Value   = 0;
            progressBar.Step    = (int)Math.Ceiling(100f / filesListBox.Items.Count);

            var results = AnalyzeArticles(filesListBox.Items.Cast <string>(), out var dashedWords);

            var csvResults = new StringBuilder();

            csvResults.AppendLine("File Name, Words ,Rare Words, Mid-Frequency Words, Rare Words List");
            var rareWordsCount       = new Dictionary <string, int>();
            var rareWordsUniqueCount = new Dictionary <string, int>();

            var i = 0;

            foreach (var result in results)
            {
                csvResults.AppendLine(
                    $"{GetFileName(filesListBox.Items[i++]!.ToString())},{result.AllWords.Count}, {result.RareWords.Count}, {result.NormalWords.Count}, " +
                    $"{(result.RareWords.Count > 0 ? result.RareWords.Aggregate((s1, s2) => $"{s1} , {s2}") : string.Empty)} ");

                foreach (var rareWord in result.RareWords.Select(rareWord => rareWord.ToLower()))
                {
                    if (rareWordsCount.ContainsKey(rareWord))
                    {
                        rareWordsCount[rareWord] = rareWordsCount[rareWord] + 1;
                    }
                    else
                    {
                        rareWordsCount[rareWord] = 1;
                    }
                }
            }

            foreach (var rareWord in rareWordsCount.Keys)
            {
                rareWordsUniqueCount[rareWord] = results.Count(r => r.RareWords.Select(w => w.ToLower()).Contains(rareWord));
            }

            var csvRareWords = new StringBuilder();

            csvRareWords.AppendLine("Rare word, Amount, Unique article appearances");


            foreach (var(key, value) in rareWordsCount.ToList().OrderByDescending(k => k.Value))
            {
                csvRareWords.AppendLine($"{key}, {value}, {rareWordsUniqueCount[key]}");
            }

            var csvDashedWords = new StringBuilder();

            csvDashedWords.AppendLine("Dashed Word, Formatted Word");

            foreach (var word in dashedWords)
            {
                csvDashedWords.AppendLine($"{word}, {string.Join(string.Empty, word.Split('-'))}");
            }

            using var directoryDialog = new FolderBrowserDialog();


            /*using var saveDialog = new SaveFileDialog
             * {
             *  DefaultExt = ".csv",
             *  Filter = "CSV files(*.csv)|*.csv",
             *  Title = "Save results file",
             *  FileName = "DeJargonizer Results " + DateTime.Now.ToString("MM-dd-yyyy HH-mm-ss")
             * };*/

            if (directoryDialog.ShowDialog() == DialogResult.OK)
            {
                var basicFileName = "DeJargonizer Results " + DateTime.Now.ToString("MM-dd-yyyy HH-mm-ss");
                var ext           = ".csv";
                File.WriteAllText(Path.Combine(directoryDialog.SelectedPath, basicFileName) + ext, csvResults.ToString());
                File.WriteAllText(Path.Combine(directoryDialog.SelectedPath, basicFileName + " Rare words") + ext,
                                  csvRareWords.ToString());
                File.WriteAllText(Path.Combine(directoryDialog.SelectedPath, basicFileName + " Dashed words") + ext,
                                  csvDashedWords.ToString());
            }

            progressBar.Visible = false;
        }
Example #32
0
        private void open_btn_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "PDF Files(*.pdf)|*.pdf|DOC Files(*.doc)|*.doc|DOCX Files(*.docx)|*.docx";
            ofd.Title  = "Select a Document";
            string file, extension, outputFile;

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                reader.Dispose();
                file = ofd.FileName;
                double size = file.Length;
                extension = System.IO.Path.GetExtension(file);
                FolderBrowserDialog fbd = new FolderBrowserDialog();
                outputFile = fbd.SelectedPath + "\\\file.pdf";//"C:\\\file.pdf";
                MessageBox.Show(size.ToString());
                if (extension == ".doc" || extension == ".docx")
                {
                    speak("This is a Microsoft Word Document, It'll take me some minutes to convert it to my readable format!!!");
                    Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
                    Microsoft.Office.Interop.Word.Document    doc = null;
                    doc = app.Documents.Open(file, Type.Missing, false);

                    // convert doc to pdf
                    doc.ExportAsFixedFormat(outputFile, WdExportFormat.wdExportFormatPDF);
                    // close doc file and quit app word
                    doc.Close(false, Type.Missing, Type.Missing);
                    app.Quit(false, false, false);
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
                    axAcroPDF1.src = outputFile;
                }
                else
                {
                    string text = string.Empty;
                    try
                    {
                        PdfReader pdf = new PdfReader(file);

                        for (int page = 1; page <= pdf.NumberOfPages; page++)
                        {
                            ITextExtractionStrategy its = new iTextSharp.text.pdf.parser.LocationTextExtractionStrategy();
                            String s = PdfTextExtractor.GetTextFromPage(pdf, page, its);
                            s    = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(s)));
                            text = text + s;
                            text.Replace("\n", "");
                            pdfText = text;

                            /*reader.Dispose();
                             * reader = new SpeechSynthesizer();
                             * reader.SpeakAsync(text);*/
                        }
                        pdf.Close();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    axAcroPDF1.src = file;
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (!resolver.HasParsedUrl)
            {
                return;
            }
            if (isListViewDirty)
            {
                CleanQueueListView();
            }
#if !DEBUG
            try
            {
#endif
            // Don't add if the item is already enqueued.
            var isAlreadyInQueue = mediaDownloadQueue.ItemById(resolver.ParseResult.Id) != null;
            if (isAlreadyInQueue)
            {
                TaskDialogHelper.ShowMessage(owner: Handle, icon: TaskDialogStandardIcon.Error,
                                             caption: "Cannot add to download queue",
                                             message: "This item already exists in the download queue.",
                                             buttons: TaskDialogStandardButtons.Ok);
            }

            // Ask for the location if required before we begin retrieval
            var prefType = PreferenceForType(resolver.ParseResult.Type);
            var saveDir  = prefType.SaveDirectory;
            if (prefType.AskForLocation)
            {
                using (var folderSelectionDialog = new FolderBrowserDialog {
                    Description = "Select a destination for this media:"
                })
                {
                    if (folderSelectionDialog.ShowDialog(this) == DialogResult.OK)
                    {
                        saveDir = folderSelectionDialog.SelectedPath;
                    }
                    else
                    {
                        return;
                    }
                }
            }

            // Build wait dialog
            var retrievalWaitTaskDialog = new TaskDialog
            {
                Cancelable        = false,
                Caption           = "Athame",
                InstructionText   = $"Getting {resolver.ParseResult.Type.ToString().ToLower()} details...",
                Text              = $"{resolver.Service.Info.Name}: {resolver.ParseResult.Id}",
                StandardButtons   = TaskDialogStandardButtons.Cancel,
                OwnerWindowHandle = Handle,
                ProgressBar       = new TaskDialogProgressBar {
                    State = TaskDialogProgressBarState.Marquee
                }
            };
            // Open handler
            retrievalWaitTaskDialog.Opened += async(o, args) =>
            {
                LockUi();
                var pathFormat = prefType.GetPlatformSaveFormat();
                try
                {
                    var media = await resolver.Resolve();

                    AddToQueue(resolver.Service, media, saveDir, pathFormat);
                }
                catch (ResourceNotFoundException)
                {
                    TaskDialogHelper.ShowMessage(caption: "This media does not exist.",
                                                 message: "Ensure the provided URL is valid, and try again", owner: Handle,
                                                 buttons: TaskDialogStandardButtons.Ok, icon: TaskDialogStandardIcon.Information);
                }
                catch (NotImplementedException)
                {
                    TaskDialogHelper.ShowMessage(
                        owner: Handle, icon: TaskDialogStandardIcon.Warning, buttons: TaskDialogStandardButtons.Ok,
                        caption: $"'{resolver.ParseResult.Type}' is not supported yet.",
                        message: "You may be able to download it in a later release.");
                }
                catch (Exception ex)
                {
                    TaskDialogHelper.ShowExceptionDialog(ex,
                                                         "An error occurred while trying to retrieve information for this media.",
                                                         "The provided URL may be invalid or unsupported.", Handle);
                }

                idTextBox.Clear();
                UnlockUi();
                retrievalWaitTaskDialog.Close();
            };
            // Show dialog
            retrievalWaitTaskDialog.Show();
#if !DEBUG
        }

        catch (Exception ex)
        {
            PresentException(ex);
        }
#endif
        }
Example #34
0
 public PhotoSlider()
 {
     InitializeComponent();
     selectFolderDialog = new FolderBrowserDialog();
 }
Example #35
0
        /// <summary>
        /// Add new topics from all files in a selected folder
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void cmdAddAllFromFolder_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            TocEntryCollection parent, newTopics = new TocEntryCollection(null);
            TocEntry           selectedTopic = ucSiteMapEditor.CurrentTopic;
            string             projectPath   = Path.GetDirectoryName(siteMapFile.ProjectElement.Project.Filename);
            int idx;

            using (FolderBrowserDialog dlg = new FolderBrowserDialog())
            {
                dlg.Description  = "Select a folder to add all of its content";
                dlg.SelectedPath = (selectedTopic != null && selectedTopic.SourceFile.Path.Length != 0) ?
                                   Path.GetDirectoryName(selectedTopic.SourceFile) : projectPath;

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        MouseCursor.Current = MouseCursors.WaitCursor;

                        newTopics.AddTopicsFromFolder(dlg.SelectedPath, dlg.SelectedPath,
                                                      siteMapFile.ProjectElement.Project);

                        MainForm.Host.ProjectExplorer.RefreshProject();
                    }
                    finally
                    {
                        MouseCursor.Current = MouseCursors.Default;
                    }
                }

                if (newTopics.Count != 0)
                {
                    if (e.Parameter == null || selectedTopic == null)
                    {
                        // Insert as siblings
                        if (selectedTopic == null)
                        {
                            parent = ucSiteMapEditor.Topics;
                            idx    = 0;
                        }
                        else
                        {
                            parent = selectedTopic.Parent;
                            idx    = parent.IndexOf(selectedTopic) + 1;
                        }

                        foreach (TocEntry t in newTopics)
                        {
                            parent.Insert(idx++, t);
                        }
                    }
                    else
                    {
                        // Insert as children
                        parent = selectedTopic.Children;

                        foreach (TocEntry t in newTopics)
                        {
                            parent.Add(t);
                        }

                        selectedTopic.IsExpanded = true;
                    }
                }
            }
        }
        private void btnBatch_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dlg = new FolderBrowserDialog();

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string path         = dlg.SelectedPath;
            string baseFileName = m_client.MyTeamName + m_client.MyUnum;

            Params.DM.MethodTypes oldMethod = Params.DM.Method;
            int    oldK       = Params.DM.K;
            double oldMinSupp = Params.DM.MinSupport;


            // save the base
            SaveClient(Path.Combine(path, baseFileName));

            int[] kValues       = new int[] { 1, 2, 5 };
            int[] minSuppValues = new int[] { 1500, 2500, 10000, 20000 };

            for (int mi = 0; mi <= 2; ++mi)
            {
                foreach (int k in kValues)
                {
                    foreach (int minSupp in minSuppValues)
                    {
                        switch (mi)
                        {
                        case 0:
                            Params.DM.Method = Params.DM.MethodTypes.Averaging;
                            break;

                        case 1:
                            Params.DM.Method = Params.DM.MethodTypes.TopQ;
                            break;

                        case 2:
                        default:
                            Params.DM.Method = Params.DM.MethodTypes.Voting;
                            break;
                        }

                        Params.DM.K          = k;
                        Params.DM.MinSupport = minSupp;

                        ((MRLDMClient)m_client).PerformDM();

                        SaveClient(Path.Combine(path, String.Format("{0}-{1}-{2}-{3}",
                                                                    baseFileName,
                                                                    mi == 0? "avg" : (mi == 1 ? "topq" : "voting"),
                                                                    k,
                                                                    minSupp)));
                        LoadClient(Path.Combine(path, baseFileName));
                    }
                }
            }

            Params.DM.Method     = oldMethod;
            Params.DM.K          = oldK;
            Params.DM.MinSupport = oldMinSupp;

            MessageBox.Show("Batch DM Done!");
        }
Example #37
0
        private void button1_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            fbd.Description = "Choose project folder";

            if (fbd.ShowDialog() == DialogResult.OK) // if user didn't cancel
            {
                proPath   = fbd.SelectedPath;
                proFolder = Path.GetFileName(proPath);


                Settings set = Settings.Default;
                set.ProjectPath   = proPath;
                set.ProjectName   = proFolder;
                set.glpsolCommand = true;
                set.Save();

                SpaceClaim.Api.V19.Window.ActiveWindow.ZoomExtents(); // used to Force a window update, so the Ribbon Button is enabled/disabled

                Directory.CreateDirectory(proPath + "/Latex");
                Directory.CreateDirectory(proPath + "/CSV");
                Directory.CreateDirectory(proPath + "/CAD");
                Directory.CreateDirectory(proPath + "/Optimization");

                try
                {
                    Command.Execute(CreateSCDOCCapsule.CommandName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString(), "Info");
                }

                // Reset Settings
                set.csv1Path         = "";
                set.csv2Path         = "";
                set.csv3Path         = "";
                set.modPath          = "";
                set.lpPath           = "";
                set.lplogPath        = "";
                set.cplexlogPath     = "";
                set.solFilePath      = "";
                set.texFilePath      = "";
                set.pdfPath          = "";
                set.distance         = 1;
                set.forces           = "";
                set.pointForceX      = 0;
                set.pointForceY      = 0;
                set.pointForceZ      = 0;
                set.activePoint      = "";
                set.xLength          = 0;
                set.yLength          = 0;
                set.zLength          = 0;
                set.forceCount       = 0;
                set.activePointCoord = "";
                set.sphereMultiplier = 1;
                set.activePointName  = "";
                set.bearingLoads     = "";
                set.bearingLoadCount = 0;
                set.deleteArrows     = "";

                this.Close();
            }
        }
        private void ImportButton_Click(object sender, EventArgs e)
        {
            using (var fbd = new FolderBrowserDialog())
            {
                DialogResult result = fbd.ShowDialog();

                //if user selects a folder
                if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
                {
                    //get all files inside the folder
                    string[] files = Directory.GetFiles(fbd.SelectedPath);

                    //iterate through all files
                    foreach (String file in files)
                    {
                        //if it's a csv file
                        if (file.Contains(".csv"))
                        {
                            if (file.Contains("client"))
                            {
                                //read the file data
                                var textRead = new StreamReader(new FileStream(file, FileMode.Open));

                                //add to ScoutingDataGrid line by line
                                while (!textRead.EndOfStream)
                                {
                                    var sb   = new StringBuilder();
                                    var line = textRead.ReadLine();

                                    sb.Append(line);

                                    string[] myArray = sb.ToString().Split(',');
                                    using (conn = new SqlConnection(csb.ConnectionString))
                                    {
                                        try
                                        {
                                            conn.Open();
                                            if (conn.State == ConnectionState.Open)                                             // if connection.Open was successful
                                            {
                                                // inserting field values into the Clients table in the database using the dataAdapter
                                                using (SqlCommand cmd = new SqlCommand("INSERT Clients " +
                                                                                       "(name, address, landLine, mobilePhone, businessName, email) " +
                                                                                       "VALUES ('" +
                                                                                       myArray[1] + "', '" +
                                                                                       myArray[2] + "', '" +
                                                                                       myArray[3] + "', '" +
                                                                                       myArray[4] + "', '" +
                                                                                       myArray[5] + "', '" +
                                                                                       myArray[6] + "')"))
                                                {
                                                    cmd.CommandType = CommandType.Text;
                                                    cmd.Connection  = conn;
                                                    int a = cmd.ExecuteNonQuery();
                                                    if (a > 0)
                                                    {
                                                        GetData(dataAdapter.SelectCommand.CommandText);
                                                        dataAdapter.Update((DataTable)bindingSource1.DataSource);

                                                        ClientNameTextBox.Text         = "";
                                                        ClientAddressTextBox.Text      = "";
                                                        ClientLandLineTextBox.Text     = "";
                                                        ClientMobilePhoneTextBox.Text  = "";
                                                        ClientBusinessNameTextBox.Text = "";
                                                        ClientEmailTextBox.Text        = "";


                                                        MessageBox.Show("Record Successfully Added!");
                                                    }
                                                    else
                                                    {
                                                        MessageBox.Show("Adding Record Failed!");
                                                    }
                                                    conn.Close();
                                                }
                                            }
                                            else
                                            {
                                                MessageBox.Show("Connection failed.");
                                            }
                                        }
                                        catch (SqlException ex)
                                        {
                                            MessageBox.Show(ex.Message);
                                        }
                                    }
                                }
                                textRead.Close();
                            }
                            else if (file.Contains("contractor"))
                            {
                                //read the file data
                                var textRead = new StreamReader(new FileStream(file, FileMode.Open));

                                //add to ScoutingDataGrid line by line
                                while (!textRead.EndOfStream)
                                {
                                    var sb   = new StringBuilder();
                                    var line = textRead.ReadLine();

                                    sb.Append(line);

                                    string[] myArray = sb.ToString().Split(',');
                                    using (conn = new SqlConnection(csb.ConnectionString))
                                    {
                                        try
                                        {
                                            conn.Open();
                                            if (conn.State == ConnectionState.Open)                                             // if connection.Open was successful
                                            {
                                                // inserting field values into the Clients table in the database using the dataAdapter
                                                using (SqlCommand cmd = new SqlCommand("INSERT Contractors " +
                                                                                       "(name, address, landLine, mobilePhone, employeeId, email) " +
                                                                                       "VALUES ('" +
                                                                                       myArray[1] + "', '" +
                                                                                       myArray[2] + "', '" +
                                                                                       myArray[3] + "', '" +
                                                                                       myArray[4] + "', '" +
                                                                                       myArray[5] + "', '" +
                                                                                       myArray[6] + "')"))
                                                {
                                                    cmd.CommandType = CommandType.Text;
                                                    cmd.Connection  = conn;
                                                    int a = cmd.ExecuteNonQuery();
                                                    if (a > 0)
                                                    {
                                                        GetData(dataAdapter.SelectCommand.CommandText);
                                                        dataAdapter.Update((DataTable)bindingSource1.DataSource);


                                                        MessageBox.Show("Record Successfully Added!");
                                                    }
                                                    else
                                                    {
                                                        MessageBox.Show("Adding Record Failed!");
                                                    }
                                                    conn.Close();
                                                }
                                            }
                                            else
                                            {
                                                MessageBox.Show("Connection failed.");
                                            }
                                        }
                                        catch (SqlException ex)
                                        {
                                            MessageBox.Show(ex.Message);
                                        }
                                    }
                                }
                                textRead.Close();
                            }
                            else if (file.Contains("job"))
                            {
                                //read the file data
                                var textRead = new StreamReader(new FileStream(file, FileMode.Open));

                                //add to ScoutingDataGrid line by line
                                while (!textRead.EndOfStream)
                                {
                                    var sb   = new StringBuilder();
                                    var line = textRead.ReadLine();

                                    sb.Append(line);

                                    string[] myArray = sb.ToString().Split(',');
                                    using (conn = new SqlConnection(csb.ConnectionString))
                                    {
                                        try
                                        {
                                            conn.Open();
                                            if (conn.State == ConnectionState.Open)                                             // if connection.Open was successful
                                            {
                                                // inserting field values into the Clients table in the database using the dataAdapter
                                                using (SqlCommand cmd = new SqlCommand("INSERT Jobs " +
                                                                                       "(shortDescription, location, dateAndTime, priority, clientId, ContractorId, jobCompleted, amountCharged) " +
                                                                                       "VALUES ('" +
                                                                                       myArray[1] + "', '" +
                                                                                       myArray[2] + "', '" +
                                                                                       myArray[3] + "', '" +
                                                                                       myArray[4] + "', '" +
                                                                                       myArray[5] + "', '" +
                                                                                       myArray[6] + "', '" +
                                                                                       myArray[7] + "', '" +
                                                                                       myArray[8] + "')"))
                                                {
                                                    cmd.CommandType = CommandType.Text;
                                                    cmd.Connection  = conn;
                                                    int a = cmd.ExecuteNonQuery();
                                                    if (a > 0)
                                                    {
                                                        GetData(dataAdapter.SelectCommand.CommandText);
                                                        dataAdapter.Update((DataTable)bindingSource1.DataSource);

                                                        JobShortDescriptionTextBox.Text = "";
                                                        JobLocationTextBox.Text         = "";
                                                        JobDateTimePicker.Value         = DateTime.Today;


                                                        MessageBox.Show("Record Successfully Added!");
                                                    }
                                                    else
                                                    {
                                                        MessageBox.Show("Adding Record Failed!");
                                                    }
                                                    conn.Close();
                                                }
                                            }
                                            else
                                            {
                                                MessageBox.Show("Connection failed.");
                                            }
                                        }
                                        catch (SqlException ex)
                                        {
                                            MessageBox.Show(ex.Message);
                                        }
                                    }
                                }
                                textRead.Close();
                            }
                        }
                    }
                }
            }
        }
Example #39
0
        private void btnSelectFolder_Click(object sender, EventArgs e)
        {
            //prompt user to confirm they want to select a new folder
            var updateFolderRequest = MessageBox.Show("Would you like to change the default root folder that taskt uses to store tasks and information? " + Environment.NewLine + Environment.NewLine +
                                                      "Current Root Folder: " + txtAppFolderPath.Text, "Change Default Root Folder", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            //if user does not want to update folder then exit
            if (updateFolderRequest == DialogResult.No)
            {
                return;
            }

            //user folder browser to let user select top level folder
            using (var fbd = new FolderBrowserDialog())
            {
                //check if user selected a folder
                if (fbd.ShowDialog() == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
                {
                    //create references to old and new root folders
                    var oldRootFolder = txtAppFolderPath.Text;
                    var newRootFolder = System.IO.Path.Combine(fbd.SelectedPath, "taskt");

                    //ask user to confirm
                    var confirmNewFolderSelection = MessageBox.Show("Please confirm the changes below:" + Environment.NewLine + Environment.NewLine +
                                                                    "Old Root Folder: " + oldRootFolder + Environment.NewLine + Environment.NewLine +
                                                                    "New Root Folder: " + newRootFolder, "Change Default Root Folder", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                    //handle if user decides to cancel
                    if (confirmNewFolderSelection == DialogResult.Cancel)
                    {
                        return;
                    }

                    //ask if we should migrate the data
                    var migrateCopyData = MessageBox.Show("Would you like to attempt to move the data from the old folder to the new folder?  Please note, depending on how many files you have, this could take a few minutes.", "Migrate Data?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    //check if user wants to migrate data
                    if (migrateCopyData == DialogResult.Yes)
                    {
                        try
                        {
                            //find and copy files
                            foreach (string dirPath in System.IO.Directory.GetDirectories(oldRootFolder, "*", SearchOption.AllDirectories))
                            {
                                System.IO.Directory.CreateDirectory(dirPath.Replace(oldRootFolder, newRootFolder));
                            }
                            foreach (string newPath in Directory.GetFiles(oldRootFolder, "*.*", SearchOption.AllDirectories))
                            {
                                System.IO.File.Copy(newPath, newPath.Replace(oldRootFolder, newRootFolder), true);
                            }

                            MessageBox.Show("Data Migration Complete", "Data Migration Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        catch (Exception ex)
                        {
                            //handle any unexpected errors
                            MessageBox.Show("An Error Occured during Data Migration Copy: " + ex.ToString());
                        }
                    }

                    //update textbox which will be updated once user selects "Ok"
                    txtAppFolderPath.Text = newRootFolder;
                }
            }
        }
Example #40
0
        static void Main(string[] args)
        {
            string root     = null;
            string destRoot = null;

            BackgroundWorker worker = new BackgroundWorker {
                WorkerReportsProgress = true
            };

            worker.DoWork += async(sender, eventArgs) =>
            {
                LoggerSingleton.GetLogger().Logged = note =>
                {
                    switch (note.NoteType)
                    {
                    case LogNoteType.Info:
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.WriteLine(note.Message);
                        break;

                    case LogNoteType.Warning:
                        Console.ForegroundColor = ConsoleColor.DarkYellow;
                        Console.WriteLine(note.Message);
                        break;

                    case LogNoteType.Error:
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(note.Message);
                        break;

                    case LogNoteType.Message:
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.WriteLine(note.Message);
                        break;

                    case LogNoteType.Secondary:
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Console.WriteLine(note.Message);
                        break;

                    case LogNoteType.Success:
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine(note.Message);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                };

                Processor processor = new Processor();

                LoggerSingleton.GetLogger().Log("Ready to processing! Please choose folders.", LogNoteType.Info);


                await processor.OrganizeForRoot(root, destRoot,
                                                true);
            };
            FolderBrowserDialog rootBrowserDialog = new FolderBrowserDialog();

            rootBrowserDialog.ShowNewFolderButton = true;
            FolderBrowserDialog destRootBrowserDialog = new FolderBrowserDialog();

            destRootBrowserDialog.ShowNewFolderButton = true;


            if (rootBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                if (destRootBrowserDialog.ShowDialog() == DialogResult.OK)
                {
                    root     = rootBrowserDialog.SelectedPath;
                    destRoot = destRootBrowserDialog.SelectedPath;
                    worker.RunWorkerAsync();
                }
            }
            Console.ReadLine();
        }
Example #41
0
        void saveLevelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (map == null)
            {
                return;
            }

            List <MapLayerData> mapLayerData = new List <MapLayerData>();

            for (int i = 0; i < clbLayers.Items.Count; i++)
            {
                if (layers[i] is MapLayer)
                {
                    MapLayerData data = new MapLayerData(
                        clbLayers.Items[i].ToString(),
                        ((MapLayer)layers[i]).Width,
                        ((MapLayer)layers[i]).Height);

                    for (int y = 0; y < ((MapLayer)layers[i]).Height; y++)
                    {
                        for (int x = 0; x < ((MapLayer)layers[i]).Width; x++)
                        {
                            data.SetTile(
                                x,
                                y,
                                ((MapLayer)layers[i]).GetTile(x, y).TileIndex,
                                ((MapLayer)layers[i]).GetTile(x, y).Tileset);
                        }
                    }

                    mapLayerData.Add(data);
                }
            }

            MapData mapData = new MapData(
                levelData.MapName,
                tileSetData,
                animatedSetData,
                mapLayerData,
                new CollisionLayer(),
                new AnimatedTileLayer());

            FolderBrowserDialog fbDialog = new FolderBrowserDialog
            {
                Description  = "Select Game Folder",
                SelectedPath = Application.StartupPath
            };

            DialogResult result = fbDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                if (!File.Exists(fbDialog.SelectedPath + @"\Game.xml"))
                {
                    MessageBox.Show("Game not found", "Error");
                    return;
                }

                string LevelPath = Path.Combine(fbDialog.SelectedPath, @"Levels\");
                string MapPath   = Path.Combine(LevelPath, @"Maps\");

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

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

                XnaSerializer.Serialize <LevelData>(LevelPath + levelData.LevelName + ".xml", levelData);
                XnaSerializer.Serialize <MapData>(MapPath + mapData.MapName + ".xml", mapData);
            }
        }
Example #42
0
        private void Form1_Load(object sender, EventArgs e)
        {
            RegistryKey key = Registry.CurrentUser.CreateSubKey("Software\\YaSLP-GUI");

            if (key.GetValue("httptimeout") == null)
            {
                key.SetValue("httptimeout", "1000");
            }
            if (key.GetValue("serverlisturl") == null)
            {
                key.SetValue("serverlisturl", "https://raw.githubusercontent.com/GreatWizard/lan-play-status/master/public/data/servers.json");
            }
            if (key.GetValue("LPClientDir") == null)
            {
                var answer = MessageBox.Show("Do you want to use the default Directory for the LANPlay Client to store? (C:\\YaSLP-GUI\\)", "Directory Setting", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                FolderBrowserDialog clientpath = new FolderBrowserDialog();
                clientpath.Description = "Choose the Folder for the LANPlay Client";
                if (answer == DialogResult.No)
                {
                    DialogResult result = clientpath.ShowDialog(this);
                    if (result == DialogResult.OK)
                    {
                        key.SetValue("LPClientDir", clientpath.SelectedPath.ToString());
                    }
                    else
                    {
                        key.SetValue("LPClientDir", "C:\\YaSLP-GUI");
                    }
                }
                else
                {
                    key.SetValue("LPClientDir", "C:\\YaSLP-GUI");
                }
                //key.SetValue("LPClientDir", "C:\\Kutaro-R3n3-LanplayGUI");
            }
            if (key.GetValue("Parameters") == null)
            {
                key.SetValue("Parameters", " ");
            }
            if (key.GetValue("Parametersmode") == null)
            {
                key.SetValue("Parametersmode", "1");
            }

            RegistryKey regkey      = Registry.CurrentUser.CreateSubKey("Software\\YaSLP-GUI");
            string      LPClientDir = regkey.GetValue("LPClientDir").ToString();

            if (!Directory.Exists(LPClientDir))
            {
                Directory.CreateDirectory(LPClientDir);
            }
            if (!File.Exists(string.Concat(LPClientDir, "\\lan-play-win64.exe")))
            {
                doclientupdate();
            }
            RegistryKey npcapparam = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\npcap\\Parameters");

            if (Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\WinPcap") == null && npcapparam.GetValue("WinPcapCompatible").ToString() != "1")
            {
                string npcaperrortext = "";
                if (npcapparam.GetValue("WinPcapCompatible").ToString() == "0")
                {
                    npcaperrortext = "\r\n NPCAP ist falsch konfiguriert! \r\n WinPcapCompatible: " + npcapparam.GetValue("WinPcapCompatible").ToString();
                }
                MessageBox.Show("WinPCAP oder NPCAP fehlt! \r\n Lanplay kann nicht gestartet werden!" + npcaperrortext, "WinPCAP oder NPCAP fehlt", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.btn_connectserver.Enabled = false;
                this.btn_winpcapdl.Visible     = true;
            }
        }
Example #43
0
        /// <summary>
        /// Загрузить папку с excel - файлами
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void g_tsmiOpen_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fdg = new FolderBrowserDialog();

            fdg.Description = string.Format("Выберите папку, содержащую все файлы для обработки сырья:\n\"{0}\"\n\"{1}\"\n\"{2}\"\n\"{3}\"", g_cFileWithMachinesName, g_cFileWithNomenclaturesName, g_cFileWithPartiesName, g_cFileWithTimes);
            if (fdg.ShowDialog() == DialogResult.OK)
            {
                var folder = fdg.SelectedPath;
                System.IO.DirectoryInfo DI = new System.IO.DirectoryInfo(fdg.SelectedPath);

                string pathForParties       = "";
                string pathForNomenclatures = "";
                string pathForMachines      = "";
                string pathForTimes         = "";

                foreach (var a in DI.GetFiles())
                {
                    if (a.Name.Equals(g_cFileWithPartiesName))
                    {
                        pathForParties = a.FullName;
                    }
                    if (a.Name.Equals(g_cFileWithNomenclaturesName))
                    {
                        pathForNomenclatures = a.FullName;
                    }
                    if (a.Name.Equals(g_cFileWithMachinesName))
                    {
                        pathForMachines = a.FullName;
                    }
                    if (a.Name.Equals(g_cFileWithTimes))
                    {
                        pathForTimes = a.FullName;
                    }
                }

                bool bAllFilesConsist = true;

                if (pathForMachines.Equals(""))
                {
                    MessageBox.Show(string.Format("Отсутствует файл {0}", g_cFileWithMachinesName));
                    bAllFilesConsist = false;
                }
                if (pathForNomenclatures.Equals(""))
                {
                    MessageBox.Show(string.Format("Отсутствует файл {0}", g_cFileWithNomenclaturesName));
                    bAllFilesConsist = false;
                }
                if (pathForParties.Equals(""))
                {
                    MessageBox.Show(string.Format("Отсутствует файл {0}", g_cFileWithPartiesName));
                    bAllFilesConsist = false;
                }
                if (pathForTimes.Equals(""))
                {
                    MessageBox.Show(string.Format("Отсутствует файл {0}", g_cFileWithTimes));
                    bAllFilesConsist = false;
                }

                if (!bAllFilesConsist)
                {
                    return;
                }

                Cursor = Cursors.WaitCursor;
                var readExcelTask = Task.Run(
                    () =>
                {
                    m_sheduleModel.ReadFromExcel(pathForMachines, pathForParties, pathForNomenclatures, pathForTimes);
                });
                readExcelTask.Wait(TIME_TO_READEXCEL_LIMIT);
                if (readExcelTask.Status != TaskStatus.RanToCompletion)
                {
                    MessageBox.Show("Ошибка, не удалось открыть файл");
                }

                g_bGenerateShedule.Enabled = true;
                g_bSaveAs.Enabled          = true;
                Cursor = Cursors.Default;
                GenerateShedule();
            }
        }
Example #44
0
        private void BUT_geinjection_Click(object sender, EventArgs e)
        {
            var MainMap = new GMapControl();

            MainMap.MapProvider = GoogleSatelliteMapProvider.Instance;

            MainMap.CacheLocation = Path.GetDirectoryName(Application.ExecutablePath) + "/gmapcache/";

            var fbd = new FolderBrowserDialog();

            try
            {
                fbd.SelectedPath = @"C:\Users\hog\Documents\albany 2011\New folder";
            }
            catch
            {
            }

            if (fbd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (fbd.SelectedPath != "")
            {
                var files  = Directory.GetFiles(fbd.SelectedPath, "*.jpg", SearchOption.AllDirectories);
                var files1 = Directory.GetFiles(fbd.SelectedPath, "*.png", SearchOption.AllDirectories);

                var origlength = files.Length;
                Array.Resize(ref files, origlength + files1.Length);
                Array.Copy(files1, 0, files, origlength, files1.Length);

                foreach (var file in files)
                {
                    log.Info(DateTime.Now.Millisecond + " Doing " + file);
                    var reg = new Regex(@"Z([0-9]+)\\([0-9]+)\\([0-9]+)");

                    var mat = reg.Match(file);

                    if (mat.Success == false)
                    {
                        continue;
                    }

                    var temp = 1 << int.Parse(mat.Groups[1].Value);

                    var pnt = new GPoint(int.Parse(mat.Groups[3].Value), int.Parse(mat.Groups[2].Value));

                    BUT_geinjection.Text = file;
                    BUT_geinjection.Refresh();

                    //MainMap.Projection.

                    var tile = new MemoryStream();

                    var Img = Image.FromFile(file);
                    Img.Save(tile, ImageFormat.Jpeg);

                    tile.Seek(0, SeekOrigin.Begin);
                    log.Info(pnt.X + " " + pnt.Y);

                    Application.DoEvents();

                    GMaps.Instance.PrimaryCache.PutImageToCache(tile.ToArray(), Custom.Instance.DbId, pnt,
                                                                int.Parse(mat.Groups[1].Value));

                    // Application.DoEvents();
                }
            }
        }
Example #45
0
 //_______________________________________________________________________________________________________________________
 public static string SelectFolder() {
     using (var fbd = new FolderBrowserDialog() { SelectedPath = @"D:\", ShowNewFolderButton = false }) {
         DialogResult result = fbd.ShowDialog();
         if (result == DialogResult.OK) return fbd.SelectedPath; else return null;
         }
     }
        /// <summary>
        /// Calling this method is identical to calling the ShowDialog method of the provided
        /// FolderBrowserDialog, except that an attempt will be made to scroll the Tree View
        /// to make the currently selected folder visible in the dialog window.
        /// </summary>
        /// <param name="dlg"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        public static DialogResult ShowFolderBrowser(FolderBrowserDialog dlg, IWin32Window parent = null)
        {
            DialogResult result  = DialogResult.Cancel;
            int          retries = 10;

            using (Timer t = new Timer())
            {
                t.Tick += (s, a) =>
                {
                    if (retries > 0)
                    {
                        --retries;
                        IntPtr hwndDlg = FindWindow((string)null, _topLevelSearchString);
                        if (hwndDlg != IntPtr.Zero)
                        {
                            IntPtr hwndFolderCtrl = GetDlgItem(hwndDlg, _dlgItemBrowseControl);
                            if (hwndFolderCtrl != IntPtr.Zero)
                            {
                                IntPtr hwndTV = GetDlgItem(hwndFolderCtrl, _dlgItemTreeView);

                                if (hwndTV != IntPtr.Zero)
                                {
                                    IntPtr item = SendMessage(hwndTV, (uint)TVM_GETNEXTITEM, new IntPtr(TVGN_CARET), IntPtr.Zero);
                                    if (item != IntPtr.Zero)
                                    {
                                        SendMessage(hwndTV, TVM_ENSUREVISIBLE, IntPtr.Zero, item);
                                        retries = 0;
                                        t.Stop();
                                    }
                                }
                            }
                        }
                    }

                    else
                    {
                        //
                        //  We failed to find the Tree View control.
                        //
                        //  As a fall back (and this is an UberUgly hack), we will send
                        //  some fake keystrokes to the application in an attempt to force
                        //  the Tree View to scroll to the selected item.
                        //
                        t.Stop();
                        //SendKeys.Send("{TAB}{TAB}{DOWN}{DOWN}{UP}{UP}");

                        IntPtr hwndDlg = FindWindow((string)null, _topLevelSearchString);
                        if (hwndDlg != IntPtr.Zero)
                        {
                            result = DialogResult.Abort;
                            DestroyWindow(hwndDlg);
                            return;// DialogResult.Abort;
                        }
                    }
                };

                t.Interval = 10;
                t.Start();

                result = dlg.ShowDialog(parent);
            }

            return(result);
        }
Example #47
0
        // funkjca wyboru plików jpg z dysku
        private void BtnOpenJPG_Click(object sender, EventArgs e)
        {
            string folderName = string.Empty;

            string[] fileNames = { };

            DialogResult result;

            string buttonName = ((Button)sender).Name;

            switch (buttonName)
            {
            case "btnOpenFiles":

                OpenFileDialog ofDialog = new OpenFileDialog
                {
                    Filter           = "JPG (*.jpg)|*.jpg",
                    Multiselect      = true,
                    InitialDirectory = Functions.IniParser.ReadIni("Files", "LastDirectory")
                };

                result = ofDialog.ShowDialog();

                if (result == DialogResult.OK)
                {
                    folderName = Path.GetDirectoryName(ofDialog.FileName);
                    fileNames  = ofDialog.FileNames;
                    Array.Sort(fileNames, new NaturalStringComparer());

                    Functions.IniParser.SaveIni("Files", "LastDirectory", folderName);
                }
                else
                {
                    return;
                }

                break;

            case "btnOpenDirectory":

                FolderBrowserDialog fbdOpen = new FolderBrowserDialog
                {
                    ShowNewFolderButton = false,
                    SelectedPath        = Functions.IniParser.ReadIni("Files", "LastDirectory")
                };

                result = fbdOpen.ShowDialog();

                if (result == DialogResult.OK)
                {
                    folderName = fbdOpen.SelectedPath;
                    fileNames  = Directory.GetFiles(folderName, "*.jpg", SearchOption.TopDirectoryOnly);
                    Array.Sort(fileNames, new NaturalStringComparer());

                    Functions.IniParser.SaveIni("Files", "LastDirectory", folderName);

                    if (fileNames.Length == 0)
                    {
                        using (FileStream stream = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"ScanHelper.jpg", FileMode.Open, FileAccess.Read))
                        {
                            _activeImage = Image.FromStream(stream);
                        }

                        pictureBoxView.Image    = ImageZoom(_activeImage, 0);
                        pictureBoxView.Left     = 0;
                        pictureBoxView.Top      = 0;
                        pictureBoxView.Location = new Point((panelView.ClientSize.Width / 2) - (pictureBoxView.Image.Width / 2), (panelView.ClientSize.Height / 2) - (pictureBoxView.Height / 2));

                        trackBarZoom.Value = 0;

                        _zoom = 0;

                        return;
                    }
                }
                else
                {
                    return;
                }

                break;
            }

            listBoxFiles.Items.Clear();

            _dsJpgFiles.Tables["JPGFiles"].Clear();
            _filesCounter = 0;
            _filesSkipped = 0;

            int id = 0;

            foreach (string pathAndFileName in fileNames)
            {
                DataRow row = _dsJpgFiles.Tables["JPGFiles"].NewRow();
                row["Id"] = id++;
                row["PathAndFileName"] = pathAndFileName;
                row["FileName"]        = pathAndFileName.Substring(pathAndFileName.LastIndexOf('\\') + 1);
                row["Path"]            = pathAndFileName.Substring(0, pathAndFileName.LastIndexOf('\\'));
                _dsJpgFiles.Tables["JPGFiles"].Rows.Add(row);

                listBoxFiles.Items.Add(row["FileName"]);
            }

            _dsJpgFiles.Tables["JPGFiles"].WriteXml("JPGFiles.xml");

            // wyświetl pierwszy z plików z listy wskazanych
            _idActiveJpg = 0;

            DataRow[] rJpgFiles = _dsJpgFiles.Tables["JPGFiles"].Select("Id = '" + _idActiveJpg + "'");

            using (FileStream stream = new FileStream(rJpgFiles[0]["PathAndFileName"].ToString(), FileMode.Open, FileAccess.Read))
            {
                _activeImage = Image.FromStream(stream);
            }

            pictureBoxView.Image    = ImageZoom(_activeImage, 0);
            pictureBoxView.Left     = 0;
            pictureBoxView.Top      = 0;
            pictureBoxView.Location = new Point((panelView.ClientSize.Width / 2) - (pictureBoxView.Image.Width / 2), (panelView.ClientSize.Height / 2) - (pictureBoxView.Height / 2));

            trackBarZoom.Value = 0;

            _zoom = 0;

            listBoxFiles.SetSelected(_idActiveJpg, true);

            long fileSize = new FileInfo(rJpgFiles[0]["PathAndFileName"].ToString()).Length / 1024;

            statusStripMainLabel.Text = $"Aktualny plik JPG: {(Convert.ToInt16(rJpgFiles[0]["Id"]) + 1)}/{_dsJpgFiles.Tables["JPGFiles"].Rows.Count} - {rJpgFiles[0]["PathAndFileName"]} [{fileSize} KB]";

            // uaktywnij przyciski, które mają wartości
            foreach (Button btn in groupBoxButtons.Controls.OfType <Button>())
            {
                if (btn.Text != @"brak")
                {
                    btn.Enabled = true;
                }
            }

            for (int i = 0; i < _btnDictionary.Length; i++)
            {
                _btnDictionary[i] = 0;
            }

            textBoxOperat.Text = folderName?.Split(Path.DirectorySeparatorChar).Last();

            btnZnakWodny.Enabled = true;
        }
Example #48
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmPluginSettings));
     this.cmdOK              = new System.Windows.Forms.Button();
     this.cmdCancel          = new System.Windows.Forms.Button();
     this.tabSettings        = new System.Windows.Forms.TabControl();
     this.tabGeneral         = new System.Windows.Forms.TabPage();
     this.lblDataPath        = new System.Windows.Forms.Label();
     this.txtDataPath        = new System.Windows.Forms.TextBox();
     this.cmdBrowse          = new System.Windows.Forms.Button();
     this.picPause           = new System.Windows.Forms.PictureBox();
     this.lblPause           = new System.Windows.Forms.Label();
     this.cmbPause           = new System.Windows.Forms.ComboBox();
     this.chkPause           = new System.Windows.Forms.CheckBox();
     this.tabDataBase        = new System.Windows.Forms.TabPage();
     this.nudDBActionTimeout = new System.Windows.Forms.NumericUpDown();
     this.lblDBActionTimeout = new System.Windows.Forms.Label();
     this.chkUseTransactions = new System.Windows.Forms.CheckBox();
     this.imlTabIcons        = new System.Windows.Forms.ImageList(this.components);
     this.cdlBrowse          = new System.Windows.Forms.FolderBrowserDialog();
     this.tabSettings.SuspendLayout();
     this.tabGeneral.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.picPause)).BeginInit();
     this.tabDataBase.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.nudDBActionTimeout)).BeginInit();
     this.SuspendLayout();
     //
     // cmdOK
     //
     this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
     this.cmdOK.Location     = new System.Drawing.Point(8, 152);
     this.cmdOK.Name         = "cmdOK";
     this.cmdOK.Size         = new System.Drawing.Size(75, 23);
     this.cmdOK.TabIndex     = 9;
     this.cmdOK.Text         = "OK";
     this.cmdOK.Click       += new System.EventHandler(this.cmdOK_Click);
     //
     // cmdCancel
     //
     this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this.cmdCancel.Location     = new System.Drawing.Point(88, 152);
     this.cmdCancel.Name         = "cmdCancel";
     this.cmdCancel.Size         = new System.Drawing.Size(75, 23);
     this.cmdCancel.TabIndex     = 10;
     this.cmdCancel.Text         = "Cancel";
     this.cmdCancel.Click       += new System.EventHandler(this.cmdCancel_Click);
     //
     // tabSettings
     //
     this.tabSettings.Controls.Add(this.tabGeneral);
     this.tabSettings.Controls.Add(this.tabDataBase);
     this.tabSettings.ImageList     = this.imlTabIcons;
     this.tabSettings.Location      = new System.Drawing.Point(8, 8);
     this.tabSettings.Name          = "tabSettings";
     this.tabSettings.SelectedIndex = 0;
     this.tabSettings.Size          = new System.Drawing.Size(264, 136);
     this.tabSettings.TabIndex      = 11;
     //
     // tabGeneral
     //
     this.tabGeneral.Controls.Add(this.lblDataPath);
     this.tabGeneral.Controls.Add(this.txtDataPath);
     this.tabGeneral.Controls.Add(this.cmdBrowse);
     this.tabGeneral.Controls.Add(this.picPause);
     this.tabGeneral.Controls.Add(this.lblPause);
     this.tabGeneral.Controls.Add(this.cmbPause);
     this.tabGeneral.Controls.Add(this.chkPause);
     this.tabGeneral.ImageIndex = 0;
     this.tabGeneral.Location   = new System.Drawing.Point(4, 23);
     this.tabGeneral.Name       = "tabGeneral";
     this.tabGeneral.Size       = new System.Drawing.Size(256, 109);
     this.tabGeneral.TabIndex   = 0;
     this.tabGeneral.Text       = "General";
     //
     // lblDataPath
     //
     this.lblDataPath.Location  = new System.Drawing.Point(8, 16);
     this.lblDataPath.Name      = "lblDataPath";
     this.lblDataPath.Size      = new System.Drawing.Size(56, 23);
     this.lblDataPath.TabIndex  = 21;
     this.lblDataPath.Text      = "Data Path";
     this.lblDataPath.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
     //
     // txtDataPath
     //
     this.txtDataPath.Location = new System.Drawing.Point(64, 16);
     this.txtDataPath.Name     = "txtDataPath";
     this.txtDataPath.Size     = new System.Drawing.Size(160, 20);
     this.txtDataPath.TabIndex = 20;
     //
     // cmdBrowse
     //
     this.cmdBrowse.Location = new System.Drawing.Point(224, 16);
     this.cmdBrowse.Name     = "cmdBrowse";
     this.cmdBrowse.Size     = new System.Drawing.Size(24, 24);
     this.cmdBrowse.TabIndex = 19;
     this.cmdBrowse.Text     = "...";
     this.cmdBrowse.UseVisualStyleBackColor = true;
     this.cmdBrowse.Click += new System.EventHandler(this.cmdBrowse_Click);
     //
     // picPause
     //
     this.picPause.Image    = ((System.Drawing.Image)(resources.GetObject("picPause.Image")));
     this.picPause.Location = new System.Drawing.Point(8, 80);
     this.picPause.Name     = "picPause";
     this.picPause.Size     = new System.Drawing.Size(24, 24);
     this.picPause.TabIndex = 18;
     this.picPause.TabStop  = false;
     //
     // lblPause
     //
     this.lblPause.Location  = new System.Drawing.Point(40, 80);
     this.lblPause.Name      = "lblPause";
     this.lblPause.Size      = new System.Drawing.Size(104, 23);
     this.lblPause.TabIndex  = 16;
     this.lblPause.Text      = "Pause delay";
     this.lblPause.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
     //
     // cmbPause
     //
     this.cmbPause.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     this.cmbPause.Items.AddRange(new object[] {
         "15 seconds",
         "30 seconds",
         "45 seconds",
         "1 minute"
     });
     this.cmbPause.Location = new System.Drawing.Point(144, 80);
     this.cmbPause.Name     = "cmbPause";
     this.cmbPause.Size     = new System.Drawing.Size(104, 21);
     this.cmbPause.TabIndex = 15;
     //
     // chkPause
     //
     this.chkPause.Location        = new System.Drawing.Point(8, 56);
     this.chkPause.Name            = "chkPause";
     this.chkPause.Size            = new System.Drawing.Size(240, 24);
     this.chkPause.TabIndex        = 14;
     this.chkPause.Text            = "Pause between consecutive operations";
     this.chkPause.CheckedChanged += new System.EventHandler(this.chkPause_CheckedChanged);
     //
     // tabDataBase
     //
     this.tabDataBase.Controls.Add(this.nudDBActionTimeout);
     this.tabDataBase.Controls.Add(this.lblDBActionTimeout);
     this.tabDataBase.Controls.Add(this.chkUseTransactions);
     this.tabDataBase.ImageIndex = 2;
     this.tabDataBase.Location   = new System.Drawing.Point(4, 23);
     this.tabDataBase.Name       = "tabDataBase";
     this.tabDataBase.Size       = new System.Drawing.Size(256, 109);
     this.tabDataBase.TabIndex   = 1;
     this.tabDataBase.Text       = "Database";
     //
     // nudDBActionTimeout
     //
     this.nudDBActionTimeout.Increment = new decimal(new int[] {
         30,
         0,
         0,
         0
     });
     this.nudDBActionTimeout.Location = new System.Drawing.Point(176, 32);
     this.nudDBActionTimeout.Maximum  = new decimal(new int[] {
         6000,
         0,
         0,
         0
     });
     this.nudDBActionTimeout.Minimum = new decimal(new int[] {
         60,
         0,
         0,
         0
     });
     this.nudDBActionTimeout.Name     = "nudDBActionTimeout";
     this.nudDBActionTimeout.Size     = new System.Drawing.Size(72, 20);
     this.nudDBActionTimeout.TabIndex = 2;
     this.nudDBActionTimeout.Value    = new decimal(new int[] {
         60,
         0,
         0,
         0
     });
     //
     // lblDBActionTimeout
     //
     this.lblDBActionTimeout.Location  = new System.Drawing.Point(8, 32);
     this.lblDBActionTimeout.Name      = "lblDBActionTimeout";
     this.lblDBActionTimeout.Size      = new System.Drawing.Size(168, 23);
     this.lblDBActionTimeout.TabIndex  = 1;
     this.lblDBActionTimeout.Text      = "Database Action Timeout (sec)";
     this.lblDBActionTimeout.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
     //
     // chkUseTransactions
     //
     this.chkUseTransactions.Location = new System.Drawing.Point(8, 8);
     this.chkUseTransactions.Name     = "chkUseTransactions";
     this.chkUseTransactions.Size     = new System.Drawing.Size(240, 24);
     this.chkUseTransactions.TabIndex = 0;
     this.chkUseTransactions.Text     = "Use Transactions (slower but more safe)";
     //
     // imlTabIcons
     //
     this.imlTabIcons.ImageStream      = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imlTabIcons.ImageStream")));
     this.imlTabIcons.TransparentColor = System.Drawing.Color.Transparent;
     this.imlTabIcons.Images.SetKeyName(0, "");
     this.imlTabIcons.Images.SetKeyName(1, "");
     this.imlTabIcons.Images.SetKeyName(2, "");
     //
     // cdlBrowse
     //
     this.cdlBrowse.Description = "Select Data Path";
     //
     // frmPluginSettings
     //
     this.AcceptButton      = this.cmdOK;
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.CancelButton      = this.cmdCancel;
     this.ClientSize        = new System.Drawing.Size(280, 181);
     this.Controls.Add(this.tabSettings);
     this.Controls.Add(this.cmdCancel);
     this.Controls.Add(this.cmdOK);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
     this.MaximizeBox     = false;
     this.MinimizeBox     = false;
     this.Name            = "frmPluginSettings";
     this.Text            = "DBUpdater Plugin Settings";
     this.Load           += new System.EventHandler(this.frmPluginSettings_Load);
     this.tabSettings.ResumeLayout(false);
     this.tabGeneral.ResumeLayout(false);
     this.tabGeneral.PerformLayout();
     ((System.ComponentModel.ISupportInitialize)(this.picPause)).EndInit();
     this.tabDataBase.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.nudDBActionTimeout)).EndInit();
     this.ResumeLayout(false);
 }
Example #49
0
        /// <summary>
        /// Browses for new stores to manage.
        /// </summary>
        private void BrowseStoreBTN_Click(object sender, EventArgs e)
        {
            try
            {
                string storeType = StoreTypeCB.SelectedItem as string;
                string storePath = null;

                if (storeType == CertificateStoreType.Directory)
                {
                    FolderBrowserDialog dialog = new FolderBrowserDialog();

                    dialog.Description         = "Select Certificate Store Directory";
                    dialog.RootFolder          = Environment.SpecialFolder.MyComputer;
                    dialog.ShowNewFolderButton = true;

                    if (dialog.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }

                    storePath = dialog.SelectedPath;
                }

                if (storeType == CertificateStoreType.X509Store)
                {
                    CertificateStoreIdentifier store = new CertificateStoreTreeDlg().ShowDialog(null);

                    if (store == null)
                    {
                        return;
                    }

                    storePath = store.StorePath;
                }

                if (String.IsNullOrEmpty(storePath))
                {
                    return;
                }

                bool found = false;

                for (int ii = 0; ii < StorePathCB.Items.Count; ii++)
                {
                    if (String.Equals(storePath, StorePathCB.Items[ii] as string, StringComparison.OrdinalIgnoreCase))
                    {
                        StorePathCB.SelectedIndex = ii;
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    StorePathCB.SelectedIndex = StorePathCB.Items.Add(storePath);
                }
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
            }
        }
Example #50
0
        private void btnDown_Click(object sender, EventArgs e)
        {
            string sql = @"SELECT 
                            [ProjectName] 项目号
                            ,[ProductName] 零件号
                            ,[TargetName] 检测项
                            ,[MeasurePoint] 检测点
                            ,[Direction] 方向
                            ,[UpperTolerance] 上公差
                            ,[LowerTolerance] 下公差
                            ,[Value1] 值1
                            ,[Value2] 值2
                            ,[Value3] 值3
                            ,[Value4] 值4
                            ,[Value5] 值5
                            ,[Value6] 值6
                            ,[Value7] 值7
                            ,[Value8] 值8
                            ,[Value9] 值9
                            ,[Value10] 值10
                            ,[Username] 用户
                            ,CONVERT(varchar(100), DATEADD(s,convert(int,Timestamp/1000),'1970-01-01 08:00:00'), 112) 时间
                            FROM [MeasureDatas] 
                            where (''=@ProjectName or ProjectName like @ProjectName)  
                            and (''=@ProductName or ProductName like @ProductName) 
                            and (''=@TargetName or TargetName like @TargetName) 
                        "
            ;


            SqlParameter[] p = new SqlParameter[] {
                new SqlParameter("@ProjectName", "%" + txtXM.Text.Trim() + "%"),
                new SqlParameter("@ProductName", "%" + txtCP.Text.Trim() + "%"),
                new SqlParameter("@TargetName", "%" + txtJCX.Text.Trim() + "%")
            };

            var dbc = db.GetSqlStringCommand(sql);

            dbc.Parameters.AddRange(p);
            var ds = db.ExecuteDataSet(dbc);


            if (null == ds || ds.Tables[0].Rows.Count <= 0)
            {
                MessageBox.Show("没有可下载文件");
            }

            FolderBrowserDialog path = new FolderBrowserDialog();

            path.ShowDialog();
            var dir = path.SelectedPath;

            var FillPath = string.Format("{0}/{1}", dir, Guid.NewGuid().ToString() + ".xlsx");

            ExcelHelper1 excel = new ExcelHelper1(FillPath);

            excel.DataTableToExcel(ds.Tables[0], "检测值", true);
            excel.Dispose();

            MessageBox.Show("下载成功");
        }
Example #51
0
        //OPTIMIZATION END

        public Form1()
        {
            InitializeComponent();

            //ANTIVIRUS START

            this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();

            lineCountList = File.ReadLines("list.txt.txt").Count();

            this.bw = new BackgroundWorker();
            this.bw.WorkerReportsProgress      = true;
            this.bw.WorkerSupportsCancellation = true;
            this.bw.DoWork          += new DoWorkEventHandler(bw_DoWork);
            this.bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);

            this.bw2 = new BackgroundWorker();
            this.bw2.WorkerReportsProgress      = true;
            this.bw2.WorkerSupportsCancellation = true;
            this.bw2.DoWork          += new DoWorkEventHandler(bw2_DoWork);
            this.bw2.ProgressChanged += new ProgressChangedEventHandler(bw2_ProgressChanged);

            //ANTIVIRUS END

            //PERFORMANCE START

            cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
            ramCounter = new PerformanceCounter("Memory", "Available MBytes");
            //ramTotalCounter = new PerformanceCounter("Memory", "Confirmed Bytes");

            this.bwCpuRamUpdater = new BackgroundWorker();
            this.bwCpuRamUpdater.WorkerReportsProgress      = true;
            this.bwCpuRamUpdater.WorkerSupportsCancellation = true;
            this.bwCpuRamUpdater.DoWork          += new DoWorkEventHandler(bwCpuRamUpdater_DoWork);
            this.bwCpuRamUpdater.ProgressChanged += new ProgressChangedEventHandler(bwCpuRamUpdater_ProgressChanged);

            if (!this.bwCpuRamUpdater.IsBusy)
            {
                this.bwCpuRamUpdater.RunWorkerAsync();
            }


            lbltotalram.Text = (new Microsoft.VisualBasic.Devices.ComputerInfo().TotalPhysicalMemory / 1e+6).ToString("N0") + " MB";

            //PERFORMANCE END

            //OPTIMIZATION START

            this.processChecker = new BackgroundWorker();
            this.processChecker.WorkerReportsProgress      = true;
            this.processChecker.WorkerSupportsCancellation = true;
            this.processChecker.DoWork          += new DoWorkEventHandler(processChecker_DoWork);
            this.processChecker.ProgressChanged += new ProgressChangedEventHandler(processChecker_ProgressChanged);

            if (!this.processChecker.IsBusy)
            {
                this.processChecker.RunWorkerAsync();
            }

            //OPTIMIZATION END
        }
Example #52
0
        private void extractToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var contextMenu = ((ToolStripMenuItem)sender).Owner;

            Package  package      = null;
            TreeNode selectedNode = null;

            // the context menu can come from a TreeView or a ListView depending on where the user clicked to extract
            // each option has a difference in where we can get the values to extract
            if (((ContextMenuStrip)((ToolStripMenuItem)sender).Owner).SourceControl is TreeView)
            {
                var tree = ((ContextMenuStrip)((ToolStripMenuItem)sender).Owner).SourceControl as TreeView;
                selectedNode = tree.SelectedNode;
                package      = tree.Tag as Package;
            }
            else if (((ContextMenuStrip)((ToolStripMenuItem)sender).Owner).SourceControl is ListView)
            {
                var listView = ((ContextMenuStrip)((ToolStripMenuItem)sender).Owner).SourceControl as ListView;
                selectedNode = listView.SelectedItems[0].Tag as TreeNode;
                package      = listView.Tag as Package;
            }

            if (selectedNode.Tag.GetType() == typeof(PackageEntry))
            {
                //We are a file
                var file = selectedNode.Tag as PackageEntry;

                var dialog = new SaveFileDialog();
                dialog.Filter   = "All files (*.*)|*.*";
                dialog.FileName = file.FileName + "." + file.TypeName;
                var userOK = dialog.ShowDialog();

                if (userOK == DialogResult.OK)
                {
                    using (var stream = dialog.OpenFile())
                    {
                        byte[] output;
                        package.ReadEntry(file, out output);
                        stream.Write(output, 0, output.Length);
                    }
                }
            }
            else
            {
                //We are a folder
                var dialog = new FolderBrowserDialog();
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    foreach (TreeNode node in selectedNode.Nodes)
                    {
                        if (node.Tag.GetType() == typeof(PackageEntry))
                        {
                            var file = node.Tag as PackageEntry;
                            Console.WriteLine(node.Text);
                            using (var stream = new FileStream(dialog.SelectedPath + Path.DirectorySeparatorChar + file.FileName + "." + file.TypeName, FileMode.Create))
                            {
                                byte[] output;
                                package.ReadEntry(file, out output);
                                stream.Write(output, 0, output.Length);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Nested Folder Extract Soon (tm)");
                        }
                    }
                }
            }
        }
Example #53
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (cbCampaignName.SelectedItem != null)
                {
                    if (strDate != null)
                    {
                        if (cbHHStart.SelectedItem != null && cbMMStart.SelectedItem != null)
                        {
                            StartDate  = strDate;
                            StartDate += " " + cbHHStart.SelectionBoxItem.ToString();
                            StartDate += ":" + cbMMStart.SelectionBoxItem.ToString();
                            StartDate += ":00";
                            StartDate += " " + cbAMPMStart.SelectionBoxItem.ToString();
                            //System.Windows.MessageBox.Show(StartDate);


                            if (endDate != null)
                            {
                                if (cbHHEnd.SelectedItem != null && cbMMEnd.SelectedItem != null)
                                {
                                    {
                                        EndDate  = endDate;
                                        EndDate += " " + cbHHEnd.SelectionBoxItem.ToString();
                                        EndDate += ":" + cbMMEnd.SelectionBoxItem.ToString();
                                        EndDate += ":00";
                                        EndDate += " " + cbAMPMEnd.SelectionBoxItem.ToString();
                                        //EndDate += " " + cbSSStart.SelectionBoxItem.ToString();
                                        //System.Windows.MessageBox.Show(EndDate);

                                        //searchQry = "select RecordedFileName from call where campaignid in(select ID from campaign where name='" + Campaign + "') and startdate>='" + strDate + "' and modifieddate<='" + endDate + "'";
                                        //searchQry = "select RecordedFileName from call where campaignid in(select ID from campaign where name='" + Campaign + "') and startdate>='" + StartDate + "' and modifieddate<='" + EndDate + "'";
                                        searchQry = "select * from call where campaignid in(select ID from campaign where name='" + Campaign + "') and startdate>='" + StartDate + "' and modifieddate<='" + EndDate + "'";



                                        if (tbAgentName.Text != null && tbAgentName.Text != "")
                                        {
                                            try
                                            {
                                                string  AgentName = tbAgentName.Text;
                                                DataSet ds        = ClsGetCamp4Phno.GetCamp4Agent(Campaign);
                                                if (ds.Tables[0].Rows.Count > 0)
                                                {
                                                    searchQry = searchQry + "and generatedby in (select id from userinfo where firstname='" + AgentName + "')";
                                                }
                                                else
                                                {
                                                    System.Windows.MessageBox.Show("Records Not Found");
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                            }
                                        }
                                        else
                                        {
                                        }
                                        if (cbClientName.SelectedItem != null && cbClientName.SelectedItem != "")
                                        {
                                            string temp = cbClientName.SelectedItem.ToString();

                                            string[] tempObj = temp.Split(':');
                                            ClientName = tempObj[1].ToString().TrimStart();
                                            searchQry  = searchQry + "and leadid in(select leadid from leaddetail where propertyvalue='" + ClientName + "')";

                                            //searchQry= searchQry + "and leadid in(select leadid from leaddetail where propertyvalue='"+ClientName+')";
                                        }
                                        else
                                        {
                                        }
                                        if (lstCRC.SelectedItems.Count > 0)
                                        {
                                            for (int i = 0; i < lstCRC.SelectedItems.Count; i++)
                                            {
                                                if (i == 0)
                                                {
                                                    // objPlayFile = "'" + lstCRC.SelectedItems[i].ToString() + "'";
                                                    objPlayFile = "'" + ((ListBoxItem)lstCRC.SelectedItems[i]).Content.ToString() + "'";
                                                }
                                                else
                                                {
                                                    objPlayFile = objPlayFile + ",'" + lstCRC.SelectedItems[i].ToString() + "'";
                                                }
                                            }
                                            searchQry = searchQry + "and despositionid in(select id from disposition where despositionname in (" + objPlayFile + "))";
                                        }
                                        else
                                        {
                                        }

                                        if (tbPhoneNumber.Text != null && tbPhoneNumber.Text != "")
                                        {
                                            string  PhoneNumber = tbPhoneNumber.Text;
                                            DataSet ds          = ClsGetCamp4Phno.GetCamp4Phno(PhoneNumber);

                                            if (ds.Tables[0].Rows.Count > 0)
                                            {
                                                searchQry = searchQry + "and leadid in(select id from leads where phoneno='" + PhoneNumber + "')";
                                            }
                                            else
                                            {
                                                System.Windows.MessageBox.Show("Records Not Found");
                                            }
                                            //searchQry = searchQry + "and createddate='" + dpStart + "'";
                                        }
                                        else
                                        {
                                            //searchQry = searchQry;
                                        }

                                        ds1 = PlayFile.Business.ClsGetSearchResult.GetSearchResult(searchQry);
                                        //PlayRecordedFileItems.Height = ds1.Tables[0].Rows.Count * 25;
                                        for (int j = 0; j < ds1.Tables[0].Rows.Count; j++)
                                        {
                                            if (j == 0)
                                            {
                                                leadID = "'" + ds1.Tables[0].Rows[j]["LeadID"].ToString() + "'";
                                            }
                                            else
                                            {
                                                leadID = leadID + ",'" + ds1.Tables[0].Rows[j]["LeadID"].ToString() + "'";
                                            }
                                        }
                                        //string phno = "select call.startdate,call.durationinsecond,call.duration,leads.phoneno from leads,call where leads.id in(" + leadID + ") and call.leadid in("+leadID+")";
                                        string phno = "select call.StartDate,call.DurationInSecond,call.RecordedFileName,leads.PhoneNo from leads,call where leads.id in(" + leadID + ") and call.leadid = leads.id";
                                        //DataSet ds2 = PlayFile.Business.ClsGetSearchResult.GetPhno(phno);

                                        ds2 = PlayFile.Business.ClsGetSearchResult.GetPhoneNo(phno);


                                        //List<PlayRecordedFile> objPlayRecordedFile = new List<PlayRecordedFile>();
                                        //for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
                                        //{
                                        //    objPlayRecordedFile.Add(PlayRecordedFile.Create(ds2.Tables[0].Rows[i]["StartDate"].ToString(), ds2.Tables[0].Rows[i]["DurationInSecond"].ToString(), ds2.Tables[0].Rows[i]["PhoneNo"].ToString(),ds2.Tables[0].Rows[i]["RecordedFileName"].ToString()));
                                        //}

                                        windowsFormsHost1.Visibility = Visibility.Visible;

                                        if (ds2.Tables.Count > 0)
                                        {
                                            ds2.Tables[0].TableName = "dtRecordedFileDetail";
                                        }
                                        rds.Name  = "dsRecordedFileDetail_dtRecordedFileDetail";
                                        rds.Value = ds2.Tables["dtRecordedFileDetail"];


                                        objReportViewer.LocalReport.ReportEmbeddedResource = "PlayFile.Presentation.rptRecordedFileDetail.rdlc";
                                        objReportViewer.LocalReport.DataSources.Clear();
                                        objReportViewer.LocalReport.DataSources.Add(rds);
                                        objReportViewer.RefreshReport();

                                        count = ds2.Tables[0].Rows.Count;

                                        sfd = new FolderBrowserDialog();

                                        if (sfd.ShowDialog() == DialogResult.OK)
                                        {
                                        }
                                        else
                                        {
                                        }
                                        selectedPath = sfd.SelectedPath.ToString();
                                        for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
                                        {
                                            try
                                            {
                                                new WebClient().DownloadFile(VMuktiAPI.VMuktiInfo.ZipFileDownloadLink + "RecordedFile/" + ds2.Tables[0].Rows[i]["RecordedFileName"].ToString() + ".zip", sfd.SelectedPath.ToString() + "\\" + ds2.Tables[0].Rows[i]["RecordedFileName"].ToString());
                                            }
                                            catch (Exception ex)
                                            {
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    System.Windows.MessageBox.Show("Select End Time");
                                }
                            }
                            else
                            {
                                System.Windows.MessageBox.Show("Select End Date");
                            }
                        }
                        else
                        {
                            System.Windows.MessageBox.Show("Select Start Time");
                        }
                    }
                    else
                    {
                        System.Windows.MessageBox.Show("Select Start Date");
                    }
                }
                else
                {
                    System.Windows.MessageBox.Show("Select Campaign Name");
                }
            }
            catch (Exception ex)
            {
            }
        }
Example #54
0
 private void InitializeComponent()
 {
     this.cbOperationMode      = new System.Windows.Forms.ComboBox();
     this.btnLeadtools         = new System.Windows.Forms.Button();
     this.btnDotnet            = new System.Windows.Forms.Button();
     this.btnITextSharp        = new System.Windows.Forms.Button();
     this.label1               = new System.Windows.Forms.Label();
     this.gbResults            = new System.Windows.Forms.GroupBox();
     this.txtSummary           = new System.Windows.Forms.TextBox();
     this.txtResults           = new System.Windows.Forms.TextBox();
     this.sourceFilePathDialog = new System.Windows.Forms.FolderBrowserDialog();
     this.targetFilePathDialog = new System.Windows.Forms.FolderBrowserDialog();
     this.btnSelectSourcePath  = new System.Windows.Forms.Button();
     this.btnSelectTargetPath  = new System.Windows.Forms.Button();
     this.lblSourceFilePath    = new System.Windows.Forms.Label();
     this.lblTargetFilePath    = new System.Windows.Forms.Label();
     this.btnAtalasoft         = new System.Windows.Forms.Button();
     this.lblProcessing        = new System.Windows.Forms.Label();
     this.btnImageMagick       = new System.Windows.Forms.Button();
     this.gbResults.SuspendLayout();
     this.SuspendLayout();
     //
     // cbOperationMode
     //
     this.cbOperationMode.FormattingEnabled = true;
     this.cbOperationMode.Location          = new System.Drawing.Point(21, 49);
     this.cbOperationMode.Name     = "cbOperationMode";
     this.cbOperationMode.Size     = new System.Drawing.Size(154, 21);
     this.cbOperationMode.TabIndex = 0;
     //
     // btnLeadtools
     //
     this.btnLeadtools.Location = new System.Drawing.Point(20, 167);
     this.btnLeadtools.Name     = "btnLeadtools";
     this.btnLeadtools.Size     = new System.Drawing.Size(75, 25);
     this.btnLeadtools.TabIndex = 1;
     this.btnLeadtools.Text     = "Leadtools";
     this.btnLeadtools.UseVisualStyleBackColor = true;
     this.btnLeadtools.Click += new System.EventHandler(this.Button_Click);
     //
     // btnDotnet
     //
     this.btnDotnet.Location = new System.Drawing.Point(101, 167);
     this.btnDotnet.Name     = "btnDotnet";
     this.btnDotnet.Size     = new System.Drawing.Size(75, 25);
     this.btnDotnet.TabIndex = 2;
     this.btnDotnet.Text     = ". Net";
     this.btnDotnet.UseVisualStyleBackColor = true;
     this.btnDotnet.Click += new System.EventHandler(this.Button_Click);
     //
     // btnITextSharp
     //
     this.btnITextSharp.Location = new System.Drawing.Point(645, 167);
     this.btnITextSharp.Name     = "btnITextSharp";
     this.btnITextSharp.Size     = new System.Drawing.Size(75, 25);
     this.btnITextSharp.TabIndex = 3;
     this.btnITextSharp.Text     = "ITextSharp";
     this.btnITextSharp.UseVisualStyleBackColor = true;
     this.btnITextSharp.Click += new System.EventHandler(this.Button_Click);
     //
     // label1
     //
     this.label1.AutoSize = true;
     this.label1.Font     = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.label1.Location = new System.Drawing.Point(18, 29);
     this.label1.Name     = "label1";
     this.label1.Size     = new System.Drawing.Size(185, 17);
     this.label1.TabIndex = 7;
     this.label1.Text     = "Type of image operation";
     //
     // gbResults
     //
     this.gbResults.Controls.Add(this.txtSummary);
     this.gbResults.Controls.Add(this.txtResults);
     this.gbResults.Location = new System.Drawing.Point(19, 198);
     this.gbResults.Name     = "gbResults";
     this.gbResults.Size     = new System.Drawing.Size(710, 486);
     this.gbResults.TabIndex = 8;
     this.gbResults.TabStop  = false;
     this.gbResults.Text     = "Results";
     //
     // txtSummary
     //
     this.txtSummary.Font       = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.txtSummary.ForeColor  = System.Drawing.Color.Red;
     this.txtSummary.Location   = new System.Drawing.Point(6, 272);
     this.txtSummary.Multiline  = true;
     this.txtSummary.Name       = "txtSummary";
     this.txtSummary.ScrollBars = System.Windows.Forms.ScrollBars.Both;
     this.txtSummary.Size       = new System.Drawing.Size(695, 214);
     this.txtSummary.TabIndex   = 6;
     //
     // txtResults
     //
     this.txtResults.Location   = new System.Drawing.Point(6, 18);
     this.txtResults.Multiline  = true;
     this.txtResults.Name       = "txtResults";
     this.txtResults.ScrollBars = System.Windows.Forms.ScrollBars.Both;
     this.txtResults.Size       = new System.Drawing.Size(695, 248);
     this.txtResults.TabIndex   = 5;
     //
     // btnSelectSourcePath
     //
     this.btnSelectSourcePath.Location = new System.Drawing.Point(21, 76);
     this.btnSelectSourcePath.Name     = "btnSelectSourcePath";
     this.btnSelectSourcePath.Size     = new System.Drawing.Size(131, 23);
     this.btnSelectSourcePath.TabIndex = 11;
     this.btnSelectSourcePath.Text     = "Select Source File Path";
     this.btnSelectSourcePath.UseVisualStyleBackColor = true;
     this.btnSelectSourcePath.Click += new System.EventHandler(this.btnSelectSourcePath_Click);
     //
     // btnSelectTargetPath
     //
     this.btnSelectTargetPath.Location = new System.Drawing.Point(21, 105);
     this.btnSelectTargetPath.Name     = "btnSelectTargetPath";
     this.btnSelectTargetPath.Size     = new System.Drawing.Size(131, 23);
     this.btnSelectTargetPath.TabIndex = 12;
     this.btnSelectTargetPath.Text     = "Select Target File Path";
     this.btnSelectTargetPath.UseVisualStyleBackColor = true;
     this.btnSelectTargetPath.Click += new System.EventHandler(this.btnSelectTargetPath_Click);
     //
     // lblSourceFilePath
     //
     this.lblSourceFilePath.AutoSize = true;
     this.lblSourceFilePath.Font     = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.lblSourceFilePath.Location = new System.Drawing.Point(201, 81);
     this.lblSourceFilePath.Name     = "lblSourceFilePath";
     this.lblSourceFilePath.Size     = new System.Drawing.Size(97, 13);
     this.lblSourceFilePath.TabIndex = 13;
     this.lblSourceFilePath.Text     = "Source file path";
     //
     // lblTargetFilePath
     //
     this.lblTargetFilePath.AutoSize = true;
     this.lblTargetFilePath.Font     = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.lblTargetFilePath.Location = new System.Drawing.Point(201, 110);
     this.lblTargetFilePath.Name     = "lblTargetFilePath";
     this.lblTargetFilePath.Size     = new System.Drawing.Size(94, 13);
     this.lblTargetFilePath.TabIndex = 14;
     this.lblTargetFilePath.Text     = "Target file path";
     //
     // btnAtalasoft
     //
     this.btnAtalasoft.Location = new System.Drawing.Point(182, 167);
     this.btnAtalasoft.Name     = "btnAtalasoft";
     this.btnAtalasoft.Size     = new System.Drawing.Size(75, 25);
     this.btnAtalasoft.TabIndex = 15;
     this.btnAtalasoft.Text     = "Atalasoft";
     this.btnAtalasoft.UseVisualStyleBackColor = true;
     this.btnAtalasoft.Click += new System.EventHandler(this.Button_Click);
     //
     // lblProcessing
     //
     this.lblProcessing.AutoSize  = true;
     this.lblProcessing.Font      = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.lblProcessing.ForeColor = System.Drawing.Color.Red;
     this.lblProcessing.Location  = new System.Drawing.Point(373, 29);
     this.lblProcessing.Name      = "lblProcessing";
     this.lblProcessing.Size      = new System.Drawing.Size(165, 29);
     this.lblProcessing.TabIndex  = 16;
     this.lblProcessing.Text      = "Processing...";
     //
     // btnImageMagick
     //
     this.btnImageMagick.Location = new System.Drawing.Point(263, 167);
     this.btnImageMagick.Name     = "btnImageMagick";
     this.btnImageMagick.Size     = new System.Drawing.Size(83, 25);
     this.btnImageMagick.TabIndex = 17;
     this.btnImageMagick.Text     = "ImageMagick";
     this.btnImageMagick.UseVisualStyleBackColor = true;
     this.btnImageMagick.Click += new System.EventHandler(this.Button_Click);
     //
     // MainForm
     //
     this.ClientSize = new System.Drawing.Size(761, 696);
     this.Controls.Add(this.btnImageMagick);
     this.Controls.Add(this.lblProcessing);
     this.Controls.Add(this.btnAtalasoft);
     this.Controls.Add(this.lblTargetFilePath);
     this.Controls.Add(this.lblSourceFilePath);
     this.Controls.Add(this.btnSelectTargetPath);
     this.Controls.Add(this.btnSelectSourcePath);
     this.Controls.Add(this.gbResults);
     this.Controls.Add(this.label1);
     this.Controls.Add(this.btnITextSharp);
     this.Controls.Add(this.btnDotnet);
     this.Controls.Add(this.btnLeadtools);
     this.Controls.Add(this.cbOperationMode);
     this.ForeColor = System.Drawing.Color.Black;
     this.Name      = "MainForm";
     this.Load     += new System.EventHandler(this.MainForm_Load);
     this.gbResults.ResumeLayout(false);
     this.gbResults.PerformLayout();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Example #55
0
        // 下载动态文件
        // 动态文件就是一直在不断增长的文件。允许一边增长一边下载
        void menu_downloadDynamicFile(object sender, System.EventArgs e)
        {
            string strError = "";

            if (this.DownloadFiles == null)
            {
                strError = "尚未绑定 DownloadFiles 事件";
                goto ERROR1;
            }

            List <TreeNode> nodes = this.GetCheckedFileNodes();

            if (nodes.Count == 0)
            {
                strError = "尚未选择要下载的配置文件节点";
                goto ERROR1;
            }

#if NO
            if (this.SelectedNode.ImageIndex != RESTYPE_FILE)
            {
                strError = "所选择的节点不是配置文件类型。请选择要下载的配置文件节点";
                goto ERROR1;
            }
#endif
            List <string> paths = new List <string>();
            foreach (TreeNode node in nodes)
            {
                string strPath = GetNodePath(node);

                string strExt = Path.GetExtension(strPath);
                if (strExt == ".~state")
                {
                    strError = "不允许下载扩展名为 .~state 的状态文件 (" + strPath + ")";
                    goto ERROR1;
                }
                paths.Add(strPath);
            }

            DownloadFilesEventArgs e1 = new DownloadFilesEventArgs();
            e1.FileNames = paths;
            this.DownloadFiles(this, e1);
            if (string.IsNullOrEmpty(e1.ErrorInfo) == false)
            {
                goto ERROR1;
            }
#if NO
            FolderBrowserDialog dir_dlg = new FolderBrowserDialog();

            dir_dlg.Description         = "请指定下载目标文件夹";
            dir_dlg.RootFolder          = Environment.SpecialFolder.MyComputer;
            dir_dlg.ShowNewFolderButton = true;
            dir_dlg.SelectedPath        = _usedDownloadFolder;

            if (dir_dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            _usedDownloadFolder = dir_dlg.SelectedPath;

            string strTargetPath = Path.Combine(dir_dlg.SelectedPath, Path.GetFileName(strPath));

            bool bAppend = false;   // 是否继续下载?
            // 观察目标文件是否已经存在
            if (File.Exists(strTargetPath))
            {
                DialogResult result = MessageBox.Show(this,
                                                      "目标文件 '" + strTargetPath + "' 已经存在。\r\n\r\n是否继续下载未完成部分?\r\n[是:从断点继续下载; 否: 重新从头下载; 取消:放弃下载]",
                                                      "KernelResTree",
                                                      MessageBoxButtons.YesNoCancel,
                                                      MessageBoxIcon.Question,
                                                      MessageBoxDefaultButton.Button1);
                if (result == DialogResult.Cancel)
                {
                    return;
                }
                if (result == DialogResult.Yes)
                {
                    bAppend = true;
                }
            }

            LibraryChannel channel     = null;
            TimeSpan       old_timeout = new TimeSpan(0);

            channel = this.CallGetChannel(true);

            old_timeout     = channel.Timeout;
            channel.Timeout = new TimeSpan(0, 5, 0);

            FileDownloadDialog dlg = new FileDownloadDialog();
            dlg.Font           = this.Font;
            dlg.SourceFilePath = strPath;
            dlg.TargetFilePath = strTargetPath;
            // dlg.TopMost = true;
            dlg.Show(this);

            DynamicDownloader downloader = new DynamicDownloader(channel,
                                                                 strPath,
                                                                 strTargetPath);
            downloader.Tag = dlg;

            _downloaders.Add(downloader);

            downloader.Closed += new EventHandler(delegate(object o1, EventArgs e1)
            {
                if (channel != null)
                {
                    channel.Timeout = old_timeout;
                    this.CallReturnChannel(channel, true);
                    channel = null;
                }
                DisplayDownloaderErrorInfo(downloader);
                RemoveDownloader(downloader);
                this.Invoke((Action)(() =>
                {
                    dlg.Close();
                }));
            });
            downloader.ProgressChanged += new DownloadProgressChangedEventHandler(delegate(object o1, DownloadProgressChangedEventArgs e1)
            {
                if (dlg.IsDisposed == false)
                {
                    dlg.SetProgress(e1.BytesReceived, e1.TotalBytesToReceive);
                }
            });
            dlg.FormClosed += new FormClosedEventHandler(delegate(object o1, FormClosedEventArgs e1)
            {
                downloader.Cancel();

                if (channel != null)
                {
                    channel.Timeout = old_timeout;
                    this.CallReturnChannel(channel, true);
                    channel = null;
                }
                DisplayDownloaderErrorInfo(downloader);
                RemoveDownloader(downloader);
            });

            downloader.StartDownload(bAppend);
#endif
            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
Example #56
0
        /// <summary>
        /// Returns a list of filepaths to files in the textures folder.
        /// </summary>
        /// <returns></returns>
        public static List <string> ListOfTextureFilePaths(string fileExtension) //TODO: Validate file extension input
        {
            string        textureFilesPath       = null;
            List <string> listOfTextureFilePaths = null;

            try
            {
                //load path to textures folder from StromoLight_Objects settings file (defaults to Resources directory in working copy)
                textureFilesPath = Properties.Settings.Default.TexturesPath;
                //attempt to load textures from Resources folder in working copy.
                try
                {
                    listOfTextureFilePaths = new List <string>(Directory.GetFiles(textureFilesPath, "*." + fileExtension));
                }
                catch (DirectoryNotFoundException workingCopyEx)
                {
                    //assume running in installation directory + try to load textures from there.
                    try
                    {
                        textureFilesPath       = @"..\Textures";
                        listOfTextureFilePaths = new List <string>(Directory.GetFiles(textureFilesPath, "*." + fileExtension));
                        System.Diagnostics.Debug.WriteLine(workingCopyEx.Message);
                    }
                    catch (DirectoryNotFoundException releasedEx)
                    {
                        if (Directory.Exists(Environment.CurrentDirectory + @"\Textures"))
                        {
                            textureFilesPath       = new DirectoryInfo(Environment.CurrentDirectory) + @"Textures";
                            listOfTextureFilePaths = new List <string>(Directory.GetFiles(textureFilesPath, "*." + fileExtension));
                        }
                        else //assume running from Visual Studio Solutions
                        {
                            DirectoryInfo dInfo = new DirectoryInfo(Environment.CurrentDirectory);
                            // go back down towards the root looking for Visual studio solutions, if you get to the root then break
                            while (dInfo.Name != "Visual Studio Solutions")
                            {
                                if (dInfo.FullName == dInfo.Root.Name)
                                {
                                    break;
                                }
                                dInfo = dInfo.Parent;
                            }
                            //go down once more to get to root of working copy.
                            dInfo            = dInfo.Parent;
                            textureFilesPath = dInfo.FullName + @"\Resources\Textures";
                            return(new List <string>(Directory.GetFiles(textureFilesPath, "*." + fileExtension)));
                        }

                        if (System.Windows.Forms.MessageBox.Show("Cannot find texture files. Navigate to directory?", "Cannot Find Texture Files", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            FolderBrowserDialog folderBrowser = new FolderBrowserDialog();
                            if (System.Environment.UserName == "mag501")
                            {
                                folderBrowser.RootFolder = Environment.SpecialFolder.MyDocuments; // + "\\Working_Copy\\Software and Solutions\\Resources\\Textures";
                            }
                            folderBrowser.ShowDialog();
                            textureFilesPath       = folderBrowser.SelectedPath;
                            listOfTextureFilePaths = new List <string>(Directory.GetFiles(textureFilesPath, "*." + fileExtension));
                        }
                        else
                        {
                            MessageBox.Show("Visualiser closing due to exception: " + releasedEx.Message, "Program closing", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            //log failure to load and exit.
                            System.Diagnostics.Debug.WriteLine(releasedEx.Message);
                            Environment.Exit(-1);
                        }
                    }
                }
            }
            catch (ArgumentException ex)
            {
                System.Diagnostics.Debug.WriteLine("File open failed. Exception message: " + ex.Message);
                System.Windows.Forms.MessageBox.Show("Failed to load all textures. Application closing", "Texture Loading Failed");
                Environment.Exit(-1);
                //return;
            }

//            System.Data.SqlClient.SqlConnection databaseConnection = new System.Data.SqlClient.SqlConnection(@"Data Source=APPC05\SQLEXPRESS;Initial Catalog=Stromohab;Integrated Security=True;Pooling=False;");
//            databaseConnection.Open();

//            foreach (string currentPath in listOfTextureFilePaths)
//            {

//                string insertString = @" INSERT INTO Bitmaps
//                                    (filepath)
//                                    VALUES ('" + currentPath + "')";

//                System.Data.SqlClient.SqlCommand mySqlCommand = new System.Data.SqlClient.SqlCommand(insertString, databaseConnection);


//                mySqlCommand.ExecuteNonQuery();

//            }
//            databaseConnection.Close();



            return(listOfTextureFilePaths);
        }
Example #57
0
        public static string RetrieveLogDirectory(bool forcePickFolder, string currentLogDirectory)
        {
            var    translator   = Languages.Instance;
            string logDirectory = null;

            if (!forcePickFolder)
            {
                logDirectory = Properties.Settings.Default.LogDirectory;
                if (string.IsNullOrEmpty(logDirectory))
                {
                    var userProfile = Environment.GetEnvironmentVariable("USERPROFILE");
                    if (userProfile != null)
                    {
                        logDirectory = Path.Combine(userProfile, @"saved games\Frontier Developments\Elite Dangerous");
                    }
                }
            }

            if (forcePickFolder || logDirectory == null || !Directory.Exists(logDirectory))
            {
                var dialog = new FolderBrowserDialog
                {
                    Description = forcePickFolder ?
                                  translator.Translate("Select a new log directory") :
                                  translator.Translate("Couln't find the log folder for elite, you'll have to specify it")
                };

                if (forcePickFolder && !string.IsNullOrEmpty(currentLogDirectory))
                {
                    dialog.SelectedPath = currentLogDirectory;
                }

                var pickFolderResult = dialog.ShowDialog();

                if (pickFolderResult == DialogResult.OK)
                {
                    if (!Directory.GetFiles(dialog.SelectedPath).Any(f => f != null &&
                                                                     Path.GetFileName(f).StartsWith("Journal.") &&
                                                                     Path.GetFileName(f).EndsWith(".log")))
                    {
                        var result =
                            MessageBox.Show(
                                translator.Translate("Selected directory doesn't seem to contain any log file ; are you sure?"),
                                translator.Translate("Warning"), MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning);

                        if (result == DialogResult.Retry)
                        {
                            RetrieveLogDirectory(forcePickFolder, null);
                        }

                        if (result == DialogResult.Abort)
                        {
                            if (forcePickFolder)
                            {
                                return(currentLogDirectory);
                            }

                            Application.Current.Shutdown();
                        }
                    }

                    logDirectory = dialog.SelectedPath;
                }
                else if (forcePickFolder)
                {
                    return(currentLogDirectory);
                }
                else
                {
                    MessageBox.Show(translator.Translate("You did not select a log directory, EDEngineer won't be able to track changes. You can still use the app manually though."),
                                    translator.Translate("Warning"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    logDirectory = @"\" + translator.Translate("No folder in use ; click to change");
                }
            }

            Properties.Settings.Default.LogDirectory = logDirectory;
            Properties.Settings.Default.Save();
            return(logDirectory);
        }
Example #58
-1
        private void FindButton_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog s = new FolderBrowserDialog();
            s.RootFolder = Environment.SpecialFolder.ApplicationData;
            // Show the FolderBrowserDialog
            DialogResult result = s.ShowDialog();

               OutputTextBlock.Text = s.SelectedPath;
                InstallLocation = s.SelectedPath;
        }
Example #59
-1
        void ChangeDownloadPath_Click(object sender, RoutedEventArgs e)
        {
            FolderBrowserDialog downloadPathChooser = new FolderBrowserDialog();

            downloadPathChooser.ShowDialog();

            DownloadPath.Text = downloadPathChooser.SelectedPath;

            PersistDownloadPath(downloadPathChooser.SelectedPath);
        }
Example #60
-1
 private void btnAA2PLAY_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog fold = new FolderBrowserDialog();
     fold.Description = @"Locate the AA2_PLAY\data folder.";
     DialogResult result = fold.ShowDialog();
     if (result == DialogResult.OK)
     {
         Configuration.WriteSetting("AA2PLAY_Path", fold.SelectedPath);
         txtAA2PLAY.Text = fold.SelectedPath;
     }
 }