コード例 #1
0
        private void browseServerFolder_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new VistaFolderBrowserDialog();

            var showDialog = dialog.ShowDialog();

            if (showDialog.HasValue && showDialog.Value)
            {
            NoDebugOrReleaseFolder:
                if (!(dialog.SelectedPath.IndexOf("debug", StringComparison.OrdinalIgnoreCase) >= 0 || dialog.SelectedPath.IndexOf("release", StringComparison.OrdinalIgnoreCase) >= 0))
                {
                    MessageBoxResult result = MessageBox.Show("The selected folder should contain the authserver.exe and worldserver.exe executables and are most of the time placed inside the 'debug' or 'release' folder. Do you still wish to continue?", "Are you sure?", MessageBoxButton.YesNo, MessageBoxImage.Question);

                    if (result != MessageBoxResult.Yes)
                    {
                        var showDialog2 = dialog.ShowDialog();

                        if (showDialog2.HasValue && showDialog2.Value)
                            goto NoDebugOrReleaseFolder;

                        return;
                    }
                }

                ServerFolderTextBox.SetValue(TextBox.TextProperty, dialog.SelectedPath);
            }
        }
コード例 #2
0
        private void btnFolderSelect_Click(object sender, RoutedEventArgs e)
        {
            VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog();
            dialog.Description = "Please select a folder.";
            dialog.UseDescriptionForTitle = true; // This applies to the Vista style dialog only, not the old dialog.

            if ((bool)dialog.ShowDialog(this))
            {
                umbracoFolder.Text = dialog.SelectedPath;

                LanguageRepository.Init(System.IO.Path.Combine(umbracoFolder.Text, @"umbraco\config\lang"));

                string[] languagecodes = LanguageRepository.ListLanguages();

                foreach (var code in languagecodes)
                {
                    Language lang = LanguageRepository.GetLanguage(code);

                    cmbSourceLanguage.Items.Add(new ComboBoxItem() { Content = string.Format("{0} [{1}]", lang.InternationalName, lang.Id), Tag = code });
                    cmbDestinationLanguage.Items.Add(new ComboBoxItem() { Content = string.Format("{0} [{1}]", lang.InternationalName, lang.Id), Tag = code });
                }

                cmbSourceLanguage.IsEnabled = true;
                cmbDestinationLanguage.IsEnabled = true;

            }
        }
コード例 #3
0
        public MainWindowViewModel()
        {
            TorrentSelected = new ReactiveCommand();
            DownloadAll = new ReactiveAsyncCommand();
            DeleteSelected = new ReactiveAsyncCommand();

            DeleteSelected.Subscribe(new AnonymousObserver<object>(x =>
            {
                App.streamza.RemoveTorrent(_selectedTorrent.id);
            }));

            DownloadAll.Subscribe(new AnonymousObserver<object>(x =>
            {
                var sel = _selectedTorrent;
                var s = new VistaFolderBrowserDialog();
                var res = s.ShowDialog();
                if (!res.HasValue || res.Value != true) return;

                var files = App.streamza.GetTorrentFiles(sel);
                foreach (var file in files)
                {
                    var uri = App.streamza.GetDownloadLink(file);
                    var cl = new WebClient();
                    var path = Path.Combine(s.SelectedPath, file.path);
                    if (!Directory.Exists(Path.GetDirectoryName(path)))
                        Directory.CreateDirectory(Path.GetDirectoryName(path));
                    cl.DownloadFile(new Uri(uri), path);
                }

                // This probably works best when there are lots of small files; doesn't
                // offer any improvement when there are only a couple of large files.
                // TODO: Check file count and set parallelism appropriately
                //Parallel.ForEach(files,
                //    new ParallelOptions { MaxDegreeOfParallelism = 4 },
                //    (file) =>
                //    {
                //        var uri = App.streamza.GetDownloadLink(file);
                //        var cl = new WebClient();
                //        var path = Path.Combine(s.SelectedPath, file.path);
                //        if (!Directory.Exists(Path.GetDirectoryName(path)))
                //            Directory.CreateDirectory(Path.GetDirectoryName(path));
                //        cl.DownloadFile(new Uri(uri), path);
                //    });
            }));

            _torrents = App.streamza.Torrents;

            Observable
                .Start(() =>
                {
                    Observable
                         .Interval(TimeSpan.FromSeconds(10))
                         .Subscribe(i =>
                         {
                             if (FetchingFiles) return;
                             _torrents = App.streamza.Torrents;
                             raisePropertyChanged("Torrents");
                         });
                });
        }
コード例 #4
0
        private void buttonSaveImage_Click(object sender, RoutedEventArgs e)
        {
            string message     = "";
            bool   checkResult = checkBeforeRender(ref message);

            if (checkResult == false)
            {
                System.Windows.MessageBox.Show(message);
                return;
            }
            System.Drawing.Imaging.ImageFormat         fmt = GlobalSettings.globalSaveFmt;
            Ookii.Dialogs.Wpf.VistaFolderBrowserDialog folderBrowserDialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog();
            if (folderBrowserDialog.ShowDialog().Value)
            {
                string saveFolderName = folderBrowserDialog.SelectedPath;
                //DO image saving
                if (GlobalSettings.bUseUnlimitHeight)
                {
                    AsynSaveSingleImage(saveFolderName, fmt);
                }
                else
                {
                    AsynSaveMultiImage(saveFolderName, fmt);
                }

                System.Windows.MessageBox.Show("Image Saved!");
            }
        }
コード例 #5
0
 private void BtnOpenSourceDirOnClick(object sender, RoutedEventArgs e)
 {
     var dlg = new VistaFolderBrowserDialog();
     var showDialog = dlg.ShowDialog(this);
     if (showDialog != null && !(bool)showDialog) return;
     TxtSourceDir.Text = dlg.SelectedPath;
 }
コード例 #6
0
        /// <summary>
        /// Presents the user with a folder browser dialog.
        /// </summary>
        /// <param name="filter">Filename filter for if the OS doesn't support a folder browser.</param>
        /// <returns>Full path the user selected.</returns>
        private static string ShowFolderBrowser(string filter)
        {
            bool cancelled = false;
            string path = null;

            if (VistaFolderBrowserDialog.IsVistaFolderDialogSupported)
            {
                var dlg = new VistaFolderBrowserDialog();

                cancelled = !(dlg.ShowDialog() ?? false);

                if (!cancelled)
                {
                    path = Path.GetFullPath(dlg.SelectedPath);
                }
            }
            else
            {
                var dlg = new Microsoft.Win32.SaveFileDialog();
                dlg.Filter = filter;
                dlg.FilterIndex = 1;

                cancelled = !(dlg.ShowDialog() ?? false);

                if (!cancelled)
                {
                    path = Path.GetFullPath(Path.GetDirectoryName(dlg.FileName)); // Discard whatever filename they chose
                }
            }

            return path;
        }
コード例 #7
0
 private void BrowseSteam_Click(object sender, RoutedEventArgs e)
 {
     var dialog = new VistaFolderBrowserDialog();
     if (dialog.ShowDialog() == true)
     {
         SteamDirectoryTextBox.Text = dialog.SelectedPath;
     }
 }
コード例 #8
0
 public void SetLocationSurfaces()
 {
     var dlg = new VistaFolderBrowserDialog();
     var showDialog = dlg.ShowDialog();
     if (showDialog == null || !((bool) showDialog)) return;
     SurfacesPath = dlg.SelectedPath;
     //SurfacesPath = @"B:\DEV\UIEdit\UIEdit\bin\Debug\surfaces.pck.files";
 }
コード例 #9
0
ファイル: MainWindow.xaml.cs プロジェクト: vba/config-watcher
        private void OnGotFocus([NotNull] object sender,
                                [NotNull] RoutedEventArgs e)
        {
            var dialog = new VistaFolderBrowserDialog();
            if(dialog.ShowDialog() != true) return;

            Model.WorkingPath = dialog.SelectedPath;
        }
コード例 #10
0
ファイル: Settings.xaml.cs プロジェクト: kenneaal/RatTracker
 private void edNetLogBrowserButton_Click(object sender, RoutedEventArgs e)
 {
     VistaFolderBrowserDialog vfbd = new VistaFolderBrowserDialog();
     vfbd.Description = "Please select your Elite:Dangerous NetLog folder (Containing NetLog files)";
     vfbd.UseDescriptionForTitle = true;
     if ((bool)vfbd.ShowDialog(this))
         Properties.Settings.Default.NetLogPath= vfbd.SelectedPath;
 }
コード例 #11
0
 private void AddSpecificFolder(object sender, RoutedEventArgs e)
 {
     VistaFolderBrowserDialog folderDialog = new VistaFolderBrowserDialog();
     bool? dialogResult = folderDialog.ShowDialog();
     if (dialogResult.GetValueOrDefault(false))
     {
         Sources.AddSpecificFolder(folderDialog.SelectedPath);
     }
 }
コード例 #12
0
 private void ChooseClipDirectory(object sender, RoutedEventArgs e)
 {
     VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog();
     Nullable<bool> r = fbd.ShowDialog();
     if (r.Value)
     {
         CurrentSession.CurrentDirectory = fbd.SelectedPath;
     }
 }
コード例 #13
0
    private void onSelectGameDir() {
      VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog();

      bool? result = fbd.ShowDialog();

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

      viewModel.Message.Settings.PathToGame = fbd.SelectedPath;
    }
コード例 #14
0
 /// <summary>
 /// Displays the folder browser dialog
 /// </summary>
 /// <param name="title"></param>
 /// <param name="filename"></param>
 public static void FolderBrowserUI(String title, out String filename)
 {
     filename = null;
     var dialog = new VistaFolderBrowserDialog
                                           {Description = title, UseDescriptionForTitle = true};
     if (dialog.ShowDialog() == true)
     {
         filename = dialog.SelectedPath;
     }
 }
コード例 #15
0
 public void SetLocationInterfaces() {
     var dlg = new VistaFolderBrowserDialog();
     var showDialog = dlg.ShowDialog();
     if (showDialog == null || !((bool) showDialog)) return;
     InterfacesPath = dlg.SelectedPath;
     Properties.Settings.Default.interfaceFilePath = InterfacesPath;
     Properties.Settings.Default.Save();
     //InterfacesPath = @"B:\DEV\UIEdit\UIEdit\bin\Debug\interfaces.pck.files";
     GenerateFileList();
 }
コード例 #16
0
ファイル: MainWindow.xaml.cs プロジェクト: zeldafreak/Area51
        private void FolderBrowseButton_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new VistaFolderBrowserDialog();

            dialog.Description = "Select the folder containing your music files.";

            if (dialog.ShowDialog(this) == true)
            {
                Controller.Model.FolderPath = dialog.SelectedPath;
            }
        }
コード例 #17
0
 /// <summary>
 /// Handles the OnClick event of the Browse control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 /// <exception cref="System.NotImplementedException"></exception>
 private void Browse_OnClick(object sender, RoutedEventArgs e)
 {
     var picker = new VistaFolderBrowserDialog {SelectedPath = Settings.ExperimentDirectory, ShowNewFolderButton = true};
     if (picker.ShowDialog().Value)
     {
         ExperimentFolder.Text = picker.SelectedPath;
         Settings.ExperimentDirectory = picker.SelectedPath;
         Directory.SetCurrentDirectory(Settings.ExperimentDirectory);
         Settings.SetPath(Settings.ExperimentDirectory);
     }
 }
コード例 #18
0
ファイル: SettingsView.xaml.cs プロジェクト: hur1can3/Espera
        private void AddSongSourceButtonClick(object sender, RoutedEventArgs e)
        {
            var dialog = new VistaFolderBrowserDialog();

            dialog.ShowDialog();

            if (!string.IsNullOrWhiteSpace(dialog.SelectedPath))
            {
                ((SettingsViewModel)this.DataContext).ChangeLibrarySource(dialog.SelectedPath);
            }
        }
コード例 #19
0
        private void SetTorrentDirectory()
        {
            // Open folder browser
            VistaFolderBrowserDialog folderSel = new VistaFolderBrowserDialog();

            // Add folder if valid folder selected
            if (folderSel.ShowDialog() == true && System.IO.Directory.Exists(folderSel.SelectedPath))
            {
                this.GeneralSettings.TorrentDirectory = folderSel.SelectedPath;
            }
        }
コード例 #20
0
ファイル: SettingsView.xaml.cs プロジェクト: hur1can3/Espera
        private void ChangeYoutubeDownloadPath(object sender, RoutedEventArgs e)
        {
            var dialog = new VistaFolderBrowserDialog();

            dialog.ShowDialog();

            if (!string.IsNullOrWhiteSpace(dialog.SelectedPath))
            {
                ((SettingsViewModel)this.DataContext).YoutubeDownloadPath = dialog.SelectedPath;
            }
        }
コード例 #21
0
ファイル: Common.cs プロジェクト: agc93/nagios
        /*
         * [Obsolete("Use Common.ChooseFolder() instead")]
         * internal static string ChooseFolderTd() {
         *  if (win.CommonFileDialog.IsPlatformSupported == true) {
         *      var dialog = new win.CommonOpenFileDialog();
         *      dialog.IsFolderPicker = true;
         *      win.CommonFileDialogResult result = dialog.ShowDialog();
         *      if (result == win.CommonFileDialogResult.Ok) {
         *          Properties.Settings.Default.FolderPath = dialog.FileName;
         *          return dialog.FileName.ToString();
         *      }
         *      return null;
         *  } else {
         *      var oldDialog = new winForms.FolderBrowserDialog();
         *      winForms.DialogResult result = oldDialog.ShowDialog();
         *      if (result == winForms.DialogResult.OK) {
         *          Properties.Settings.Default.FolderPath = oldDialog.SelectedPath.ToString();
         *          return oldDialog.SelectedPath.ToString();
         *      }
         *      return null;
         *  }
         * } */

        internal static string ChooseFolder()
        {
            td.VistaFolderBrowserDialog dlg = new td.VistaFolderBrowserDialog();
            dlg.Description            = "Choose a destination folder...";
            dlg.UseDescriptionForTitle = true;
            if ((bool)dlg.ShowDialog())
            {
                Properties.Settings.Default.FolderPath = dlg.SelectedPath.ToString();
            }
            return(null);
        }
コード例 #22
0
        private void SelectFolderButton_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog();

            if (!dialog.ShowDialog(this).GetValueOrDefault())
            {
                return;
            }

            OutputFolder = dialog.SelectedPath;
            outFolderPathText.Content = OutputFolder;
        }
コード例 #23
0
 public void Execute(object parameter)
 {
     VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog
     {
         Description = "Please select a folder.",
         UseDescriptionForTitle = true
     };
     if (dialog.ShowDialog() == true)
     {
         viewModel.Settings.SaveLocation = dialog.SelectedPath;
     }
 }
コード例 #24
0
		private void FindPathClick(object sender, RoutedEventArgs e)
		{
			var dlg = new VistaFolderBrowserDialog();

			if (!HistoryPath.Text.IsEmpty())
				dlg.SelectedPath = HistoryPath.Text;

			if (dlg.ShowDialog() == true)
			{
				HistoryPath.Text = dlg.SelectedPath;
			}
		}
コード例 #25
0
 public void SetLocationInterfaces()
 {
     var dlg = new VistaFolderBrowserDialog();
     var showDialog = dlg.ShowDialog();
     if (showDialog == null || !((bool) showDialog)) return;
     InterfacesPath = dlg.SelectedPath;
     //InterfacesPath = @"B:\DEV\UIEdit\UIEdit\bin\Debug\interfaces.pck.files";
     Files = new List<SourceFile>();
     foreach (var file in Directory.GetFiles(InterfacesPath, "*.xml", SearchOption.AllDirectories)) {
         Files.Add(new SourceFile { FileName = file, ProjectPath = InterfacesPath});
     }
 }
コード例 #26
0
		private void FindPathClick(object sender, RoutedEventArgs e)
		{
			var dlg = new VistaFolderBrowserDialog();

			if (!SecuritiesCsv.Text.IsEmpty())
				dlg.SelectedPath = SecuritiesCsv.Text;

			if (dlg.ShowDialog(this) == true)
			{
				SecuritiesCsv.Text = dlg.SelectedPath;
			}
		}
コード例 #27
0
ファイル: Settings.xaml.cs プロジェクト: Adanaran/RatTracker
        private void edDirBrowserButton_Click(object sender, RoutedEventArgs e)
        {
            VistaFolderBrowserDialog vfbd = new VistaFolderBrowserDialog();
            vfbd.Description = "Please select your Elite:Dangerous folder (Containing the launcher executable)";
            vfbd.UseDescriptionForTitle = true;
            if ((bool)vfbd.ShowDialog(this))
            {
                Properties.Settings.Default.EDPath = vfbd.SelectedPath;
                Properties.Settings.Default.NetLogPath = vfbd.SelectedPath + @"\Products\elite-dangerous-64\Logs";
            }

        }
コード例 #28
0
		private void SelectDestinationDirectory_Click(object sender, System.Windows.RoutedEventArgs e)
		{
			VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog();
			dialog.Description = WPFLocalizeExtensionHelpers.GetUIString("SelectFolderForDownloads");
			dialog.UseDescriptionForTitle = true; // This applies to the Vista style dialog only, not the old dialog.
			if ((bool)dialog.ShowDialog())
			{
				if (!String.IsNullOrEmpty(dialog.SelectedPath))
				{
					DestinationDirectory.Text = dialog.SelectedPath;
				}
			}
		}
コード例 #29
0
        private void BrowseButton_Click(object sender, RoutedEventArgs e)
        {
            var folderBrowser = new VistaFolderBrowserDialog()
            {
                ShowNewFolderButton = false,
                Description = this.Description,
                UseDescriptionForTitle = true
            };

            if (folderBrowser.ShowDialog() != true) return;

            DirectoryPath = folderBrowser.SelectedPath;
        }
コード例 #30
0
        public static bool ShowBrowseDownloadFolder(out string selectedPath, string initialPath) {
            var dlg = new VistaFolderBrowserDialog();
            dlg.Description = "Locate podcast download folder";
            dlg.ShowNewFolderButton = true;
            dlg.UseDescriptionForTitle = true;
            dlg.SelectedPath = initialPath;

            if (dlg.ShowDialog(Owner) ?? false) {
                selectedPath = dlg.SelectedPath;
                return true;
            }

            selectedPath = null;
            return false;
        }
コード例 #31
0
        public async Task<String> ShowFolderDialog(String caption)
        {
            VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog();
            dialog.Description = "Please select a folder.";
            dialog.UseDescriptionForTitle = true;
            bool? result = await Task.Run(() => dialog.ShowDialog());

            if (result.HasValue && result.Value)
            {
                return dialog.SelectedPath;
            }
            else
            {
                return null;
            }
        }
コード例 #32
0
		private void LocationPathBtn_Click(object sender, RoutedEventArgs e)
		{
			VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog();
			fbd.UseDescriptionForTitle = true;
			if (Directory.Exists(LocationPathBox.Text))
			{
				fbd.SelectedPath = LocationPathBox.Text;
			}
			fbd.Description = "Choose Save Path...";

			bool? result = fbd.ShowDialog();
			if (result == true)
			{
				LocationPathBox.Text = fbd.SelectedPath;
			}
		}
コード例 #33
0
		private void selectBackupsFolder_Click(object sender, RoutedEventArgs e)
		{
			var dialog = new VistaFolderBrowserDialog
							{
								Description = WPFLocalizeExtensionHelpers.GetUIString("SelectFolderForBackups"),
								UseDescriptionForTitle = true
							};
			// This applies to the Vista style dialog only, not the old dialog.
			var showDialog = dialog.ShowDialog();
			if (showDialog != null && (bool)showDialog)
			{
				if (!String.IsNullOrEmpty(dialog.SelectedPath))
				{
					backupsFolder.Text = dialog.SelectedPath;
				}
			}
		}
コード例 #34
0
        private void DestinationButton_Click(object sender, RoutedEventArgs e)
        {
            Ookii.Dialogs.Wpf.VistaFolderBrowserDialog dlg = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog();
            dlg.ShowNewFolderButton    = true;
            dlg.Description            = "Please select a folder where you would like to save the DeepZoom images.";
            dlg.UseDescriptionForTitle = true;
            bool?dialogSuccess = dlg.ShowDialog();

            if (dialogSuccess.HasValue)
            {
                if (dialogSuccess.Value)
                {
                    destPath = dlg.SelectedPath;
                }
            }

            //Update the GUI
            DestinationTextBox.Text = destPath;
        }
コード例 #35
0
        private void SourceButton_Click(object sender, RoutedEventArgs e)
        {
            Ookii.Dialogs.Wpf.VistaFolderBrowserDialog dlg = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog();
            dlg.ShowNewFolderButton    = true;
            dlg.Description            = "Please select a folder where your TIF images are located.";
            dlg.UseDescriptionForTitle = true;
            bool?dialogSuccess = dlg.ShowDialog();

            if (dialogSuccess.HasValue)
            {
                if (dialogSuccess.Value)
                {
                    sourcePath = dlg.SelectedPath;
                }
            }

            //Update the GUI
            SourceTextBox.Text = sourcePath;
        }
コード例 #36
0
    public bool SelectFolder(out string folderPath, string description = "", string directory = "", bool showNewFolderButton = false)
    {
        var fbd = new FolderBrowserDialog
        {
            Description         = description,
            ShowNewFolderButton = showNewFolderButton
        };

        if (!string.IsNullOrEmpty(directory))
        {
            fbd.SelectedPath = GetDirectoryPath(directory);
        }

        bool result = fbd.ShowDialog().GetValueOrDefault();

        folderPath = result ? fbd.SelectedPath : string.Empty;

        return(result);
    }