Esempio n. 1
1
        /// <summary>
        /// The Destination Path
        /// </summary>
        public void BrowseDestination()
        {
            VistaSaveFileDialog dialog = new VistaSaveFileDialog
                {
                    Filter = "mp4|*.mp4;*.m4v|mkv|*.mkv",
                    AddExtension = true,
                    OverwritePrompt = true,
                    DefaultExt = ".mp4"
                };
            dialog.ShowDialog();

            if (!string.IsNullOrEmpty(dialog.FileName))
            {
                switch (Path.GetExtension(dialog.FileName))
                {
                    case ".mkv":
                        this.SelectedOutputFormat = OutputFormat.Mkv;
                        break;
                    case ".mp4":
                        this.SelectedOutputFormat = OutputFormat.Mp4;
                        break;
                    case ".m4v":
                        this.SelectedOutputFormat = OutputFormat.M4V;
                        break;
                }

                this.Destination = dialog.FileName;
                this.NotifyOfPropertyChange(() => this.CurrentTask);
            }
        }
Esempio n. 2
0
        public string GetFileSavePath(string title, string defaultExt, string filter)
        {
            if (VistaFileDialog.IsVistaFileDialogSupported)
            {
                var saveFileDialog = new VistaSaveFileDialog
                                     {
                                         Title = title,
                                         DefaultExt = defaultExt,
                                         CheckFileExists = false,
                                         RestoreDirectory = true,
                                         Filter = filter
                                     };

                if (saveFileDialog.ShowDialog() == true)
                    return saveFileDialog.FileName;
            }
            else
            {
                var ofd = new Microsoft.Win32.SaveFileDialog
                          {
                              Title = title,
                              DefaultExt = defaultExt,
                              CheckFileExists = false,
                              RestoreDirectory = true,
                              Filter = filter
                          };

                if (ofd.ShowDialog() == true)
                    return ofd.FileName;
            }

            return "";
        }
Esempio n. 3
0
        public mainForm()
        {
            try
            {
                finishedLoading = false;
                activeOrInActiveMainForm = this;

                Program.Settings = Settings.LoadSettings();
                Program.Settings.DirectoryList.Initialize();

                InitializeComponent();
                initFilesDataGridViewCheckAllCheckBox();
                foldersListBox.DataSource = Program.Settings.DirectoryList.Directories;
                compileResultsDataGridView.DataSource = new List<Models.CompileCommandResult>();
                folderBrowserDialog = new VistaFolderBrowserDialog();
                outputFileDialog = new VistaSaveFileDialog()
                {
                    AddExtension = true,
                    Filter = "*.css|*.css"
                };

                CheckForLessUpdates();
            }
            catch (Exception e)
            {
                ExceptionHandler.LogException(e);
            }
        }
Esempio n. 4
0
        public string GetFileSavePath(string title, string defaultExt, string filter)
        {
            if (VistaSaveFileDialog.IsVistaFileDialogSupported)
            {
                VistaSaveFileDialog saveFileDialog = new VistaSaveFileDialog();
                saveFileDialog.Title = title;
                saveFileDialog.DefaultExt = defaultExt;
                saveFileDialog.CheckFileExists = false;
                saveFileDialog.RestoreDirectory = true;

                saveFileDialog.Filter = filter;

                if (saveFileDialog.ShowDialog() == true)
                    return saveFileDialog.FileName;
            }
            else
            {
                Microsoft.Win32.SaveFileDialog ofd = new Microsoft.Win32.SaveFileDialog();
                ofd.Title = title;
                ofd.DefaultExt = defaultExt;
                ofd.CheckFileExists = false;
                ofd.RestoreDirectory = true;

                ofd.Filter = filter;

                if (ofd.ShowDialog() == true)
                    return ofd.FileName;
            }

            return "";
        }
Esempio n. 5
0
		public object GetPath(Security security, Type dataType, object arg, DateTime? from, DateTime? to, IMarketDataDrive drive)
		{
			var fileName = security.GetFileName(dataType, arg, from, to, ExportType);

			var dlg = new VistaSaveFileDialog
			{
				FileName = fileName,
				RestoreDirectory = true
			};

			switch (ExportType)
			{
				case ExportTypes.Excel:
					dlg.Filter = @"xlsx files (*.xlsx)|*.xlsx|All files (*.*)|*.*";
					break;
				case ExportTypes.Xml:
					dlg.Filter = @"xml files (*.xml)|*.xml|All files (*.*)|*.*";
					break;
				case ExportTypes.Txt:
					dlg.Filter = @"text files (*.txt)|*.txt|All files (*.*)|*.*";
					break;
				case ExportTypes.Sql:
				{
					var wnd = new DatabaseConnectionWindow();

					if (wnd.ShowModal(this))
					{
						DatabaseConnectionCache.Instance.AddConnection(wnd.Connection);
						return wnd.Connection;
					}

					return null;
				}
				case ExportTypes.Bin:
				{
					var wndFolder = new VistaFolderBrowserDialog();

					if (drive is LocalMarketDataDrive)
						wndFolder.SelectedPath = drive.Path;

					return wndFolder.ShowDialog(this.GetWindow()) == true
						? DriveCache.Instance.GetDrive(wndFolder.SelectedPath)
						: null;
				}
				default:
				{
					new MessageBoxBuilder()
						.Error()
						.Owner(this)
						.Text(LocalizedStrings.Str2910Params.Put(ExportType))
							.Show();

					return null;
				}
			}

			return dlg.ShowDialog(this.GetWindow()) == true ? dlg.FileName : null;
		}
Esempio n. 6
0
		bool SaveProj() {
			if (!firstSaved || !File.Exists(FileName)) {
				var sfd = new VistaSaveFileDialog();
				sfd.FileName = FileName;
				sfd.Filter = "ConfuserEx Projects (*.crproj)|*.crproj|All Files (*.*)|*.*";
				sfd.DefaultExt = ".crproj";
				sfd.AddExtension = true;
				if (!(sfd.ShowDialog(Application.Current.MainWindow) ?? false) || sfd.FileName == null)
					return false;
				FileName = sfd.FileName;
			}
			ConfuserProject proj = ((IViewModel<ConfuserProject>)Project).Model;
			proj.Save().Save(FileName);
			Project.IsModified = false;
			firstSaved = true;
			return true;
		}
Esempio n. 7
0
 public static bool TryFileSavePath(string dialogTitle, string filter, out string fileName)
 {
     var fileSelector = new VistaSaveFileDialog()
     {
         Title = dialogTitle,
         Filter = filter,
         DefaultExt = filter.Split('|').ElementAt(1).Replace("*", "") // It SHOULD be an extension method, so todo
     };
     if (fileSelector.ShowDialog() == true)
     {
         fileName = fileSelector.FileName;
         return true;
     }
     else
     {
         fileName = string.Empty;
         return false;
     }
 }
Esempio n. 8
0
        /// <summary>
        /// The Destination Path
        /// </summary>
        public void BrowseDestination()
        {
            VistaSaveFileDialog dialog = new VistaSaveFileDialog
                {
                    Filter = "mp4|*.mp4;*.m4v|mkv|*.mkv",
                    AddExtension = true,
                    OverwritePrompt = true,
                    DefaultExt = ".mp4"
                };
            dialog.ShowDialog();

            this.CurrentTask.Destination = dialog.FileName;
            this.NotifyOfPropertyChange("CurrentTask");
            this.SetExtension(Path.GetExtension(dialog.FileName));
        }
Esempio n. 9
0
		private void ExecutedSaveCommand(object sender, ExecutedRoutedEventArgs e)
		{
			var dlg = new VistaSaveFileDialog
			{
				RestoreDirectory = true,
				Filter = @"csharp files (*.cs)|*.cs|All files (*.*)|*.*",
				DefaultExt = "cs"
			};

			if (dlg.ShowDialog(this.GetWindow()) == true)
			{
				File.WriteAllText(dlg.FileName, CodePanel.Code);
			}
		}
Esempio n. 10
0
    private async Task onSaveObjectAsExecute() {
      VistaSaveFileDialog sfd = new VistaSaveFileDialog {
        FileName   = export.NameTableIndex.Name,
        DefaultExt = export.DomainObject.FileExtension,
        Filter     = $"{export.DomainObject.FileTypeDesc}|*{export.DomainObject.FileExtension}",
        Title      = "Save Object As..."
      };

      bool? result = sfd.ShowDialog();

      if (!result.HasValue || !result.Value) return;

      int compressor = menuViewModel.IsCompressorClusterFit ? 0 : menuViewModel.IsCompressorRangeFit ? 1 : 2;

      int errorMetric = menuViewModel.IsErrorMetricPerceptual ? 0 : 1;

      DdsSaveConfig config = new DdsSaveConfig(FileFormat.Unknown, compressor, errorMetric, menuViewModel.IsWeightColorByAlpha, false);

      await export.DomainObject.SaveObject(sfd.FileName, config);
    }
Esempio n. 11
0
        /// <summary>
        /// Export a Preset
        /// </summary>
        public void PresetExport()
        {
            VistaSaveFileDialog savefiledialog = new VistaSaveFileDialog { Filter = "plist|*.plist", CheckPathExists = true };
            if (this.selectedPreset != null)
            {
                savefiledialog.ShowDialog();
                string filename = savefiledialog.FileName;

                if (filename != null)
                {
                    PlistUtility.Export(savefiledialog.FileName, this.selectedPreset, userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild).ToString());
                }
            }
            else
            {
                MessageBox.Show("Please select a preset.", "Presets", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
        private void btnSaveAs_Click(object sender, RoutedEventArgs e)
        {
            VistaSaveFileDialog dialog = new VistaSaveFileDialog();

            dialog.Title = "Save your translation as..";
            dialog.Filter = "Xml files (*.xml)|*.xml|All files (*.*)|*.*";
            dialog.OverwritePrompt = true;
            dialog.DefaultExt = "xml";
            dialog.AddExtension = true;
            dialog.FileName = DestinationLanguage + ".xml";

            if ((bool)dialog.ShowDialog())
            {
                string file = dialog.FileName;

                Language destination = LanguageRepository.GetLanguage(DestinationLanguage);

                destination.Save(file);

            }
        }
Esempio n. 13
0
        /// <summary>
        /// Export the Queue to a file.
        /// </summary>
        public void Export()
        {
            VistaSaveFileDialog dialog = new VistaSaveFileDialog
                {
                    Filter = "HandBrake Queue Files (*.hbq)|*.hbq",
                    OverwritePrompt = true,
                    DefaultExt = ".hbq",
                    AddExtension = true
                };
            dialog.ShowDialog();

            this.queueProcessor.QueueManager.BackupQueue(dialog.FileName);
        }
Esempio n. 14
0
        /// <summary>
        /// Export a Preset
        /// </summary>
        public void PresetExport()
        {
            VistaSaveFileDialog savefiledialog = new VistaSaveFileDialog
                                                     {
                                                         Filter = "plist|*.plist",
                                                         CheckPathExists = true,
                                                         AddExtension = true,
                                                         DefaultExt = ".plist",
                                                         OverwritePrompt = true,
                                                         FilterIndex = 0
                                                     };
            if (this.selectedPreset != null)
            {
                savefiledialog.ShowDialog();
                string filename = savefiledialog.FileName;

                if (!string.IsNullOrEmpty(filename))
                {
                    PlistUtility.Export(
                        savefiledialog.FileName,
                        this.selectedPreset,
                        userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild)
                                          .ToString(CultureInfo.InvariantCulture));
                }
            }
            else
            {
                MessageBox.Show("Please select a preset.", "Presets", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Esempio n. 15
0
 public BrowseSaveFileCommand(Action<string> actionOnExecute, Func<object, bool> executeFunc, string filter)
     : base(null, executeFunc)
 {
     m_saveAction = actionOnExecute;
     m_dialog = new VistaSaveFileDialog {Filter = filter, AddExtension = true};
 }
Esempio n. 16
0
		private void ExecuteSaveLayoutCommand(object sender, ExecutedRoutedEventArgs e)
		{
			var dlg = new VistaSaveFileDialog
			{
				Filter = LocalizedStrings.Str3584,
				DefaultExt = "xml",
				RestoreDirectory = true
			};

			if (dlg.ShowDialog(Application.Current.GetActiveOrMainWindow()) != true)
				return;

			var cmd = new SaveLayoutCommand();

			cmd.SyncProcess(SelectedStrategy);

			if (!cmd.Layout.IsEmpty())
				File.WriteAllText(dlg.FileName, cmd.Layout);
		}
		private void ExecutedOpenReportCommand(object sender, ExecutedRoutedEventArgs e)
		{
			var type = (string)e.Parameter;

			var dlg = new VistaSaveFileDialog
			{
				Filter = LocalizedStrings.Str3591Params.Put(type),
				DefaultExt = type,
				RestoreDirectory = true,
				//AddExtension = false,
			};

			if (dlg.ShowDialog(Application.Current.GetActiveOrMainWindow()) != true)
				return;

			var path = dlg.FileName;
			var strategies = SelectedStrategies ?? new[] { SelectedStrategy };

			switch (type)
			{
				case "csv":
					new CsvStrategyReport(strategies, path).Generate();
					break;

				case "xlsx":
					new ExcelStrategyReport(strategies, path).Generate();
					break;

				case "xml":
					new XmlStrategyReport(strategies, path).Generate();
					break;
			}

			path.OpenFile();
		}
        private void SetSourcePath()
        {
            VistaSaveFileDialog ofd = new VistaSaveFileDialog();
            ofd.Filter = "All Files|*.*";
            ofd.FileName = this.Item.SourcePath;
            if (ofd.ShowDialog() == false)
                return;

            this.Item.SourcePath = ofd.FileName;
        }
Esempio n. 19
0
 private void Save()
 {
     var dlg = new VistaSaveFileDialog {
         Filter = "Solution File (*.sln)|*.sln",
         AddExtension = true,
         DefaultExt = ".sln"
     };
     if (dlg.ShowDialog() == true) {
         InternalSave(dlg.FileName);
     }
 }
Esempio n. 20
0
        /// <summary>
        /// Export the Queue to a file.
        /// </summary>
        public void Export()
        {
            VistaSaveFileDialog dialog = new VistaSaveFileDialog { Filter = "HandBrake Queue Files (*.hbq)|*.hbq"};
            dialog.ShowDialog();

            this.queueProcessor.QueueManager.BackupQueue(dialog.FileName);
        }
Esempio n. 21
0
    private async Task onExportHexViewExecute() {
      VistaSaveFileDialog sfd = new VistaSaveFileDialog {
        FileName   = title,
        DefaultExt = ".txt",
        Filter     = "Text Files|*.txt",
        Title      = "Save Hex View As..."
      };

      bool? result = sfd.ShowDialog();

      if (!result.HasValue || !result.Value) return;

      StreamWriter stream = new StreamWriter(File.OpenWrite(sfd.FileName));

      foreach(DomainHexData hexData in viewModel.HexData) {
        string line = $"0x{hexData.Index:X8} 0x{hexData.FileIndex:X8} {hexData.HexValues} {hexData.AsciiValues}";

        await stream.WriteLineAsync(line);
      }

      await stream.FlushAsync();

      stream.Close();
    }
        public string ShowSaveFileDialog(
            IWindow owner,
            bool addExtension,
            bool checkFileExists,
            bool checkPathExists,
            string defaultExt,
            bool dereferenceLinks,
            string filter,
            bool createPrompt,
            bool overwritePrompt,
            string title,
            string initialDirectory,
            out bool? result)
        {
            bool? tempresult = null;

            try
            {
                return ObservableObject.CurrentDispatcher.Invoke(
                    () =>
                    {
                        var dialog = new VistaSaveFileDialog
                        {
                            AddExtension = addExtension,
                            CheckFileExists = checkFileExists,
                            DefaultExt = defaultExt,
                            DereferenceLinks =
                                dereferenceLinks,
                            Filter = filter,
                            Title = title,
                            CheckPathExists = checkPathExists,
                            CreatePrompt = createPrompt,
                            OverwritePrompt = overwritePrompt,
                            InitialDirectory =
                                initialDirectory
                        };

                        TranslateDefaultExt(dialog);

                        tempresult = owner != null
                                         ? dialog.ShowDialog(
                                             (Window)
                                             owner
                                                 .TranslateForTechnology
                                                 ())
                                         : dialog.ShowDialog();

                        return tempresult == false ? null : dialog.FileName;
                    });
            }
            finally
            {
                result = tempresult;
            }
        }
Esempio n. 23
0
 public void Save()
 {
     var dlg = new VistaSaveFileDialog {
         Filter = "Solution File (*.sln)|*.sln",
         AddExtension = true,
         DefaultExt = ".sln"
     };
     if (dlg.ShowDialog() == true) {
         new SaveSolutionCommand(_settings, dlg.FileName, _settings.VisualStudioVersion, this).Execute();
         IsDirty = false;
     }
 }
Esempio n. 24
0
        /// <summary>
        /// Export a Preset
        /// </summary>
        public void PresetExport()
        {
            VistaSaveFileDialog savefiledialog = new VistaSaveFileDialog { Filter = "plist|*.plist", CheckPathExists = true };
            if (this.selectedPreset != null)
            {
                savefiledialog.ShowDialog();
                string filename = savefiledialog.FileName;

                if (filename != null)
                {
                    PlistUtility.Export(savefiledialog.FileName, this.selectedPreset);
                }
            }
            else
            {
                MessageBox.Show("Please select a preset.", "Presets", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Esempio n. 25
0
 /// <summary>
 /// Export a CSV file.
 /// </summary>
 public void Export()
 {
     var saveFileDialog = new VistaSaveFileDialog
         {
            Filter = "Csv File|*.csv", DefaultExt = "csv", CheckPathExists = true
         };
     saveFileDialog.ShowDialog();
     if (!string.IsNullOrEmpty(saveFileDialog.FileName))
     {
         this.ExportChaptersToCSV(saveFileDialog.FileName);
     }
 }
Esempio n. 26
0
        private void Save()
        {
            VistaSaveFileDialog dlg = new VistaSaveFileDialog();
            dlg.Filter = "JaAnDoTilgung Project files (*.jtp)|*.jtp";

            if (dlg.ShowDialog() == true)
            {
                string filename = dlg.FileName;

                Finanzierung finaToSave = null;

                if (this.OriginalFina != null)
                {
                    finaToSave = this.OriginalFina;
                }
                else
                {
                    finaToSave = this.Fina;
                }

                var serializer = new DataContractSerializer(finaToSave.GetType(), null,
                    int.MaxValue,
                    false,
                    true,
                    null);

                FileStream writer = new FileStream(filename, FileMode.Create, FileAccess.Write);

                serializer.WriteObject(writer, finaToSave);

                writer.Close();
            }
        }
Esempio n. 27
0
        private void Save()
        {
            if (_fileName == null)
            {
                var dialog = new VistaSaveFileDialog { Filter = _filter };
                if (dialog.ShowDialog() == true)
                {
                    _fileName = dialog.FileName;
                }
                else
                {
                    return;
                }

            }
            using (FileStream fileStream = File.OpenWrite(_fileName))
            {
                var bf = new BinaryFormatter();
                bf.Serialize(fileStream, Board);
            }
        }
Esempio n. 28
0
        private void SaveAsTxt()
        {
            VistaSaveFileDialog dlg = new VistaSaveFileDialog();
            dlg.Filter = "Text-files (*.txt)|*.txt";

            if (dlg.ShowDialog() == true)
            {
                string filename = dlg.FileName;

                StreamWriter writer = File.CreateText(filename);

                Finanzierung finaToSave = null;

                finaToSave = this.Fina;

                foreach (Darlehen dar in finaToSave.Quellen)
                {
                    writer.WriteLine(String.Format("Tilgungsplan Darlehen {1} Summe {0}EUR", dar.Summe.ToString("F2"), dar.Bezeichnung));
                    foreach (Annuitaet ann in dar.Annuitaeten)
                    {
                        writer.WriteLine(String.Format(
                            "{0} Darlehen: {1} EUR  Tilgung: {2} EUR  Zinsen: {3} EUR  Annuität: {4} EUR"
                            , ann.Zahlungsdatum.ToString()
                            , ann.DarlehenssumeVorZahlung.ToString("F2").PadLeft(10)
                            , ann.Gesamttilgung.ToString("F2").PadLeft(10)
                            , ann.Zins.Zins.ToString("F2").PadLeft(10)
                            , (ann.Gesamttilgung + ann.Zins.Zins).ToString("F2").PadLeft(10)));
                    }
                }

                writer.Close();
            }
        }
Esempio n. 29
0
        /// <summary>
        /// The Destination Path
        /// </summary>
        public void BrowseDestination()
        {
            VistaSaveFileDialog dialog = new VistaSaveFileDialog
                {
                    Filter = "mp4|*.mp4;*.m4v|mkv|*.mkv",
                    AddExtension = true,
                    OverwritePrompt = true,
                    DefaultExt = ".mp4",
                };

            if (this.CurrentTask != null && !string.IsNullOrEmpty(this.CurrentTask.Destination))
            {
                if (Directory.Exists(Path.GetDirectoryName(this.CurrentTask.Destination)))
                {
                    dialog.InitialDirectory = Path.GetDirectoryName(this.CurrentTask.Destination) + "\\";
                    dialog.FileName = Path.GetFileName(this.CurrentTask.Destination);
                }
            }

            dialog.ShowDialog();
            this.Destination = dialog.FileName;

            // Set the Extension Dropdown. This will also set Mp4/m4v correctly.
            if (!string.IsNullOrEmpty(dialog.FileName))
            {
                switch (Path.GetExtension(dialog.FileName))
                {
                    case ".mkv":
                        this.SelectedOutputFormat = OutputFormat.Mkv;
                        break;
                    case ".mp4":
                        this.SelectedOutputFormat = OutputFormat.Mp4;
                        break;
                    case ".m4v":
                        this.SelectedOutputFormat = OutputFormat.M4V;
                        break;
                }

                this.NotifyOfPropertyChange(() => this.CurrentTask);
            }
        }
Esempio n. 30
0
 /// <summary>
 /// The Destination Path
 /// </summary>
 public void BrowseDestination()
 {
     VistaSaveFileDialog dialog = new VistaSaveFileDialog { Filter = "MP4 File (*.mp4)|Mkv File(*.mkv)" };
     dialog.ShowDialog();
     dialog.AddExtension = true;
     this.CurrentTask.Destination = dialog.FileName;
     this.NotifyOfPropertyChange("CurrentTask");
 }