Beispiel #1
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();

            System.Windows.Forms.DialogResult result = dialog.ShowDialog();
            if (result.ToString() == "Cancel")
            {
                debug.richTextBox1.AppendText("Aborting add folder...\n");
                debug.richTextBox1.ScrollToEnd();
                return;
            }
            int index = dialog.SelectedPath.Split('\\').Length - 1;

            if (dialog.SelectedPath.Split('\\')[index] == "")
            {
                debug.richTextBox1.AppendText("Path ended with slash, handling it...\n");
                debug.richTextBox1.ScrollToEnd();
                listBox.Items.Add(dialog.SelectedPath.Split('\\')[index - 1]);
                folders.Add(dialog.SelectedPath);
            }
            else
            {
                listBox.Items.Add(dialog.SelectedPath.Split('\\')[index]);
                folders.Add(dialog.SelectedPath);
            }
            //Console.WriteLine("+" + result.ToString() + "+");
        }
        private void button_save_Click(object sender, RoutedEventArgs e)
        {
            if (!Connection.CheckConnection())
            {
                indikacenetu();
                System.Windows.MessageBox.Show("No internet connection, please connect first");
            }
            else
            {
                if (dataGrid.Items.Count == 0)
                {
                    System.Windows.MessageBox.Show("No data available");
                }

                else
                {
                    using (var dialog = new System.Windows.Forms.FolderBrowserDialog())
                    {
                        dialog.SelectedPath = settingshandler.getStorageTB();
                        System.Windows.Forms.DialogResult result = dialog.ShowDialog();
                        if (result.ToString() == "OK")
                        {
                            settingshandler.setStorageTB(dialog.SelectedPath);
                            try
                            {
                                getter.SaveFile(settingshandler.getStorageTB(), GitFile.convertorToDict(dataGrid.SelectedItems.Cast <GitFile>().ToList(), getter.FilesChanges));
                                System.Windows.MessageBox.Show("Saved");
                            }
                            catch (ArgumentNullException ex)
                            {
                                System.Windows.MessageBox.Show("No data available");
                            }
                            catch (NullReferenceException ex)
                            {
                                System.Windows.MessageBox.Show("Error");
                            }
                        }
                    }
                }
            }


            //// Configure save file dialog box
            //Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
            //dlg.FileName = "Document"; // Default file name
            //dlg.DefaultExt = ".text"; // Default file extension
            //dlg.Filter = "Text documents (.txt)|*.txt"; // Filter files by extension

            //// Show save file dialog box
            //Nullable<bool> result = dlg.ShowDialog();

            //// Process save file dialog box results
            //if (result == true)
            //{
            //    // Save document
            //    string filename = dlg.FileName;
            //}
        }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            subform.FolderBrowserDialog folderDialog = new subform.FolderBrowserDialog();
            folderDialog.SelectedPath = "C:\\";

            subform.DialogResult result = folderDialog.ShowDialog();
            if (result.ToString() == "OK")
            {
                saveLocation.Text = folderDialog.SelectedPath;
            }
        }
Beispiel #4
0
        private void btnBrowse_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            var dlg = new WinForms.FolderBrowserDialog();

            System.Windows.Forms.DialogResult result = dlg.ShowDialog(this.GetIWin32Window());

            if (result.ToString() == "OK")
            {
                txtDirectory.Text = dlg.SelectedPath;
            }
        }
        private void btnImportDesign_Click(object sender, RibbonControlEventArgs e)
        {
            string sourceFilePath = String.Empty;

            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
            System.Windows.Forms.DialogResult   dialogResult   = openFileDialog.ShowDialog();
            if (dialogResult.ToString() == "OK")
            {
                string fileId = ImportDesign(openFileDialog.FileName.ToString());
                ReloadDesignList(fileId);
                LinkDesignToDocument();
            }
        }
 public void SetPath()
 {
     using (var dialog = new System.Windows.Forms.FolderBrowserDialog())
     {
         System.Windows.Forms.DialogResult result = dialog.ShowDialog();
         if (result.ToString() == "OK")
         {
             path = dialog.SelectedPath;
         }
         else
         {
             path = "";
         }
     }
 }
        private void RXGCFoldeButton_Click(object sender, RoutedEventArgs e)
        {
            WinForms.FolderBrowserDialog      dialogue = new System.Windows.Forms.FolderBrowserDialog();
            System.Windows.Forms.DialogResult result   = dialogue.ShowDialog();
            projectPath = result.ToString();

            if (result == WinForms.DialogResult.OK)
            {
                RXGCPath = dialogue.SelectedPath;
            }

            RXGCFolderPath.Text = RXGCPath;
            Properties.Settings.Default.RXGCFolderPath = RXGCPath;
            Properties.Settings.Default.Save();
        }
Beispiel #8
0
        public void SelectOutputDirectory(object sender, RoutedEventArgs e)
        {
            using (var dialog = new System.Windows.Forms.FolderBrowserDialog())
            {
                System.Windows.Forms.DialogResult result = dialog.ShowDialog();

                if (result.ToString() == "OK" && !string.IsNullOrWhiteSpace(dialog.SelectedPath))
                {
                    OutputDirectoryTextBox.Text = dialog.SelectedPath;

                    Properties.Settings.Default.outputDirectory = dialog.SelectedPath;
                    Properties.Settings.Default.Save();
                }
            }
        }
Beispiel #9
0
        private void Init()
        {
            OpenKspInstallFolderCommand = new DelegateCommand(
                () =>
            {
                var dlg = new FolderBrowserDialog();
                System.Windows.Forms.DialogResult result = dlg.ShowDialog();

                if (result.ToString() == "OK")
                {
                    InstallPath = dlg.SelectedPath;
                }
            });

            SaveCommand = new DelegateCommand <string>(
                (arg) =>
            {
                switch (arg)
                {
                case "Save":
                    Save.Save();
                    break;

                case "Scenario":
                    Scenario.Save();
                    break;

                case "TrainingScenario":
                    TrainingScenario.Save();
                    break;

                case "VabCraft":
                    VabCraft.Save();
                    break;

                case "SphCraft":
                    SphCraft.Save();
                    break;

                case "Part":
                    Part.Save();
                    break;
                }
            });
        }
        private void loadFolder_Click(object sender, RoutedEventArgs e)
        {
            string SelectedFolder;
            // This menu will launch the menu to choose folders. Here, the users get to pick which gallery folder to choose.
            var dialog = new FolderBrowserDialog();

            System.Windows.Forms.DialogResult result = dialog.ShowDialog();
            // this if statement is here to make sure the user ACTUALLY picked a folder and not just exited out.
            if (result.ToString() == "OK")
            {
                SelectedFolder = dialog.SelectedPath.ToString();
            }
            else
            {
                return;
            }

            GrabPictures(SelectedFolder);
        }
        private void Button_Browse_Click(object sender, RoutedEventArgs e)
        {
            // FEATURE NOTE: this is for folder selecting only
            WinForms.FolderBrowserDialog folderBrowser = new WinForms.FolderBrowserDialog
            {
                RootFolder = Environment.SpecialFolder.Desktop
            };
            WinForms.DialogResult folderBrowser_Status = folderBrowser.ShowDialog();
            if (folderBrowser_Status.ToString() == "OK")
            {
                TextBox_PathInputField.Text = folderBrowser.SelectedPath;
            }

            // TODO: FEATURE NOTE: this is for file selecting only
            //WinForms.OpenFileDialog openFileBrowser = new WinForms.OpenFileDialog();
            //WinForms.DialogResult openFileBrowser_Status = openFileBrowser.ShowDialog();
            //TextBox_PathInputField.Text = openFileBrowser.FileName;
            //if (openFileBrowser_Status.ToString() == "OK")
            //    TextBox_PathInputField.Text = openFileBrowser.FileName;
        }
        private void ProjectFolderButton_Click(object sender, RoutedEventArgs e)
        {
            WinForms.FolderBrowserDialog      dialogue = new System.Windows.Forms.FolderBrowserDialog();
            System.Windows.Forms.DialogResult result   = dialogue.ShowDialog();
            projectPath = result.ToString();

            if (result == WinForms.DialogResult.OK)
            {
                projectPath = dialogue.SelectedPath;
            }
            if (projectPath == "Cancel")
            {
                projectPath = "";
            }

            ProjectFolderPath.Text = projectPath;
            Properties.Settings.Default.StoredProjectPath = projectPath;

            Properties.Settings.Default.Save();
        }
 private void button_export_Click(object sender, RoutedEventArgs e)
 {
     if (dataGrid.Items.Count == 0)
     {
         System.Windows.MessageBox.Show("No data available");
     }
     else
     {
         using (var dialog = new System.Windows.Forms.FolderBrowserDialog())
         {
             //dialog.SelectedPath = settingshandler.getStorageTB();
             System.Windows.Forms.DialogResult result = dialog.ShowDialog();
             if (result.ToString() == "OK")
             {
                 Save.ExportFilesToExcel((dataGrid.ItemsSource != null) ? dataGrid.ItemsSource.Cast <GitFile>().ToList() : null, dialog.SelectedPath); //dataGrid.SelectedItems.Cast<GitFile>().ToList()
                 System.Windows.MessageBox.Show("Saved");
             }
         }
     }
 }
        private void BackupFolderTwoButton_Click(object sender, RoutedEventArgs e)
        {
            //OpenFileDialog openFileDialog = new OpenFileDialog();
            //if (openFileDialog.ShowDialog() == true) ProjectPath = File.ReadAllText(openFileDialog.FileName);

            WinForms.FolderBrowserDialog      dialogue = new System.Windows.Forms.FolderBrowserDialog();
            System.Windows.Forms.DialogResult result   = dialogue.ShowDialog();
            BackupTwoPath = result.ToString();

            if (result == WinForms.DialogResult.OK)
            {
                BackupTwoPath = dialogue.SelectedPath;
            }
            if (BackupTwoPath == "Cancel")
            {
                BackupTwoPath = "";
            }
            BackupFolderTwoPath.Text = BackupTwoPath;
            Properties.Settings.Default.StoredBackupTwoPath = BackupTwoPath;

            Properties.Settings.Default.Save();
        }
Beispiel #15
0
        public void Browse(object sender, RoutedEventArgs e)
        {
            FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();

            System.Windows.Forms.DialogResult result = dialog.ShowDialog();
            string s = result.ToString();

            if (s == "OK")
            {
                string buttenName = ((System.Windows.Controls.Button)sender).Name;
                if (buttenName.Equals("browse1"))
                {
                    Path1 = dialog.SelectedPath;
                }
                if (buttenName.Equals("browse2"))
                {
                    Path2 = dialog.SelectedPath;
                }
                if (buttenName.Equals("browse4"))
                {
                    Path4 = dialog.SelectedPath;
                }
            }
        }
Beispiel #16
0
        private void cmdUpdate_Click(object sender, System.EventArgs e)
        {
            string strValue, strName, strType;

            strValue = txtParamValue.Text;
            strName  = txtParamName.Text;
            strType  = m_dt.Rows[m_manager.Position]["PARAM_TYPE"].ToString();

            System.Windows.Forms.DialogResult i = MessageBox.Show(clsResources.GetMessage("messages.save"), clsResources.GetMessage("messages.general"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (i.ToString() == "No")
            {
                return;
            }

            if (strValue == "")
            {
                MessageBox.Show(clsResources.GetMessage("errors.fill", txtParamValue.Text), clsResources.GetMessage("messages.general"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtParamValue.Focus();
                txtParamValue.SelectAll();
                return;
            }
//			if(strType =="s" && m_dt.Rows[m_manager.Position]["PARAM_NAME"].ToString() != "WS_RURAL_SKU_REMINDER_PERIOD") //nghiahbt added 28-May-07
//			{
//				strDes = m_dt.Rows[m_manager.Position]["DESCRIPTION"].ToString();
//				if(strDes.IndexOf("day")!= -1)
//				{
//					strValue = strValue.ToUpper();
//					if(strValue!= "MON" && strValue!= "TUE" && strValue!= "WED"
//						&& strValue!= "THU" && strValue!= "FRI" && strValue!= "SAT" && strValue!= "SUN")
//					{
//						MessageBox.Show(strDes,clsResources.GetMessage("messages.general"),MessageBoxButtons.OK, MessageBoxIcon.Error);
//						txtParamValue.Focus();
//						txtParamValue.SelectAll();
//						return;
//
//					}
//				}
//			}
            if (bo.Validate(strType, strValue) == false)
            {
//				if(strType=="s")
//					MessageBox.Show(clsResources.GetMessage("errors.exist", txtParamValue.Text), clsResources.GetMessage("messages.general"), MessageBoxButtons.OK, MessageBoxIcon.Error);
//				else
                if (strType == "t" || strType == "n")
                {
                    MessageBox.Show(clsResources.GetMessage("errors.number", "Time"), clsResources.GetMessage("messages.general"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (strType == "d")
                {
                    MessageBox.Show(clsResources.GetMessage("errors.date"), clsResources.GetMessage("messages.general"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (strType == "b")
                {
                    MessageBox.Show(clsResources.GetMessage("errors.bool"), clsResources.GetMessage("messages.general"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                m_dt.RejectChanges();
                txtParamValue.Focus();
                txtParamValue.SelectAll();
                return;
            }

            if (bo.Update(strValue, strName))
            {
                m_dt.Rows[m_manager.Position]["PARAM_VALUE"] = txtParamValue.Text;
                m_dt.AcceptChanges();
                MessageBox.Show(clsResources.GetMessage("messages.success"), clsResources.GetMessage("messages.general"), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #17
0
 public override string ToString()
 {
     return(DialogResult.ToString() + " Filename = " + FileName);
 }
Beispiel #18
0
        public static void ShowConnectionPromptForm(MainForm frm)
        {
            PFConnectionManager connMgr = null;
            DatabasePlatform    dbPlat  = DatabasePlatform.MSSQLServer;
            bool runTests = false;

            try
            {
                _msg.Length = 0;
                _msg.Append("ShowConnectionPromptForm started ...\r\n");
                Program._messageLog.WriteLine(_msg.ToString());

                connMgr = new PFConnectionManager();

                ConnectionStringPrompt            cp  = new ConnectionStringPrompt(dbPlat, connMgr);
                System.Windows.Forms.DialogResult res = cp.ShowConnectionPrompt();
                if (res == System.Windows.Forms.DialogResult.OK)
                {
                    runTests    = true;
                    _msg.Length = 0;
                    _msg.Append("Connection name:   ");
                    _msg.Append(cp.ConnectionName);
                    _msg.Append(Environment.NewLine);
                    _msg.Append("Connection string: ");
                    _msg.Append(cp.ConnectionString);
                    _msg.Append(Environment.NewLine);
                    _msg.Append("Connection Definition: ");
                    _msg.Append(Environment.NewLine);
                    if (cp.ConnectionDefinition != null)
                    {
                        _msg.Append(cp.ConnectionDefinition.ToString());
                        _msg.Append(Environment.NewLine);
                    }
                    Program._messageLog.WriteLine(_msg.ToString());
                }
                else
                {
                    _msg.Length = 0;
                    _msg.Append("User cancelled connection string request: ");
                    _msg.Append(res.ToString());
                    Program._messageLog.WriteLine(_msg.ToString());
                }

                if (runTests)
                {
                    //cp.ConnectionDefinition.SaveToXmlFile(@"c:\temp\TestConnectionDefinition.xml");

                    //PFConnectionDefinition newCP = PFConnectionDefinition.LoadFromXmlFile(@"c:\temp\TestConnectionDefinition.xml");

                    //cp.ConnectionDefinition.ConnectionKeyElements.SaveToXmlFile(@"c:\temp\ConnectionKeyElements.xml");
                    //PFList<stKeyValuePair<string, string>> elementsList = cp.ConnectionDefinition.ConnectionKeyElements.ConvertThisToPFKeyValueListEx();
                    //elementsList.SaveToXmlFile(@"c:\temp\ConnectionKeyElements_PFList.xml");

                    //Program._messageLog.WriteLine(Environment.NewLine + "newCP TO STRING:" + Environment.NewLine + newCP.ToString() + Environment.NewLine + "END newCP TO STRING" + Environment.NewLine);

                    //PFKeyValueList<string, string> testlist = PFKeyValueList<string, string>.LoadFromXmlString(cp.ConnectionDefinition.DbPlatformConnectionStringProperties[15].Value);
                    //Program._messageLog.WriteLine(testlist.ToXmlString());

                    //cp.ConnectionDefinition.DbPlatformConnectionStringProperties.SaveToXmlFile(@"c:\temp\DbPlatformConnectionStringProperties.xml");

                    //Program._messageLog.WriteLine(Environment.NewLine + "-----------");
                    //string dumpOutput = PFObjectDumper.Write(cp, 0);
                    //Program._messageLog.WriteLine(dumpOutput);
                    //Program._messageLog.WriteLine(Environment.NewLine + "-----------");

                    //cp = null;
                    //newCP = null;
                }
            }
            catch (System.Exception ex)
            {
                _msg.Length = 0;
                _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex));
                Program._messageLog.WriteLine(_msg.ToString());
                AppMessages.DisplayErrorMessage(_msg.ToString(), _saveErrorMessagesToAppLog);
            }
            finally
            {
                _msg.Length = 0;
                _msg.Append("\r\n... ShowConnectionPromptForm finished.");
                Program._messageLog.WriteLine(_msg.ToString());
            }
        }