Exemplo n.º 1
0
        private void save(string fileName)
        {
            if (fileName == null)
            {
                requestSaveFileDialog.FileName = FilePathFormatter.Format(lastOpenedRequestFilePath, FilePathFormat.Short);
                setUpFileDialogs();
                if (requestSaveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    fileName = requestSaveFileDialog.FileName;
                    Settings.Default.SaveRequestFileDialogFolder = FilePathFormatter.Format(fileName, FilePathFormat.FullDir);
                }
                else
                {
                    return;
                }
            }

            if (fileName.ToUpper() == Settings.Default.DefaultRequestFilePath.ToUpper() &&
                DialogResult.No == showChallenge("Overwrite Default Request File", "Are you sure you want to overwrite the default request file?"))
            {
                return;
            }

            var requestVm = buildRequestViewModel();

            requestVm.Save(fileName);
            updateLastOpenedRequestFile(fileName);
        }
Exemplo n.º 2
0
 private void updateLastOpenedRequestFile(string fileName)
 {
     this.lastOpenedRequestFilePath    = fileName;
     this.isLastOpenedRequestFileDirty = false;
     this.Text =
         fileName == null ?
         programName :
         FilePathFormatter.Format(fileName, FilePathFormat.ShortFileFullDir) + " - " + programName;
 }
Exemplo n.º 3
0
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     requestOpenFileDialog.FileName = null;
     setUpFileDialogs();
     if (requestOpenFileDialog.ShowDialog() == DialogResult.OK)
     {
         var fileName = requestOpenFileDialog.FileName;
         openRequestFile(fileName);
         Settings.Default.SaveRequestFileDialogFolder = FilePathFormatter.Format(fileName, FilePathFormat.FullDir);
     }
 }
Exemplo n.º 4
0
 private void updateLastOpenedRequestFile(string fileName)
 {
     this.lastOpenedRequestFilePath    = fileName;
     this.isLastOpenedRequestFileDirty = false;
     this.Text = FilePathFormatter.Format(fileName, FilePathFormat.ShortFileFullDir) + " - REST API Browser";
 }