private void ListBoxItem_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (lbPaths.SelectedItem is string filePath) { SMExeFilePath = new SuperMemoFilePath(filePath, _nativeDataCfg); } }
/// <inheritdoc /> public override void OnDisplayed() { if (SMExeSuggestedFilePaths == null) { SMExeFilePath = new SuperMemoFilePath(_startupCfg.SuperMemo.SMBinPath, _nativeDataCfg); SMExeSuggestedFilePaths = new ObservableHashSet <string>(SuperMemoFinderUtil.SearchSuperMemoInDefaultLocations() .Select(fp => fp.FullPathWin)); Task.Run(SearchForSuperMemo).RunAsync(); } }
private void Browse() { OpenFileDialog dlg = new OpenFileDialog { DefaultExt = ".exe", Filter = "Executable (*.exe)|*.exe|All files (*.*)|*.*" }; var filePath = dlg.ShowDialog().GetValueOrDefault(false) ? dlg.FileName : null; if (filePath != null) { SMExeFilePath = new SuperMemoFilePath(filePath, _nativeDataCfg); } }
public SuperMemoFinder(NativeDataCfg nativeDataCfg, StartupCfg startupCfg) { _nativeDataCfg = nativeDataCfg; _startupCfg = startupCfg; SMExeFilePath = new SuperMemoFilePath(startupCfg.SMBinPath, nativeDataCfg); SMExeSuggestedFilePaths = SuperMemoFinderUtil.SearchSuperMemoInDefaultLocations() .Select(fp => fp.FullPathWin) .ToHashSet(); AcceptCommand = new RelayCommand(Accept, CanAcceptExecute); BrowseCommand = new RelayCommand(Browse); BuildDescriptionText(); Task.Run(SearchForSuperMemo).RunAsync(); InitializeComponent(); }