public RecentFileInfoViewModel(RecentFileInfo rfi) { if (rfi != null) { Data = rfi; } }
public void CopyPath(RecentFileInfo recentFileInfo) { if (recentFileInfo != null) { _viewInteractionResolver.PutClipboardText(recentFileInfo.FullPath); } }
void allGoodsView_SelectionChanged(object sender, EventArgs e) { DataGridView theView = sender as DataGridView; Dictionary <string, string> allGoods = theView.Tag as Dictionary <string, string>; if (theView == null || allGoods == null) { throw new Exception("The DataGridView is not ready."); } BindingSource summaryBindings = theView.DataSource as BindingSource; if (summaryBindings == null) { throw new Exception("Null BindingSource!"); } List <PoboDayFileSummary> summaries = summaryBindings.DataSource as List <PoboDayFileSummary>; if (summaries == null) { throw new Exception("The fileName list is not available!"); } string name = summaries[theView.CurrentRow.Index].Name; TheQuote = new RecentFileInfo(name, allGoods[name], SourceType.Pobo); //SelectedFileName = allGoods[fileName]; //Identification = fileName; }
public void RevealInExplorer(RecentFileInfo recentFileInfo) { if (recentFileInfo != null) { _viewInteractionResolver.RevealInExplorer(recentFileInfo.FullPath); } }
public void UnPinItem(RecentFileInfo recentFileInfo) { if (recentFileInfo != null) { PathDefinitions.SetRecentFileFixed(recentFileInfo.FullPath, false); } }
public void RemoveFromList(RecentFileInfo recentFileInfo) { if (recentFileInfo != null) { PathDefinitions.RemoveRecentFile(recentFileInfo.FullPath); } }
public async Task OpenRecentItem(RecentFileInfo info) { if (info == null) { return; } await _databaseInteractions.OpenDatabase(info.FullPath); }
public void OpenRecentItem(RecentFileInfo info) { if (info == null) { return; } _databaseInteractions.OpenDatabase(info.FullPath); }
internal void Add(string filePath, string fileName, List <RecentFileInfo> list) { LogHelper.Begin("WorkspaceService.Add"); try { RecentFileInfo rfi = list.Find(p => p.FileName == fileName && p.FilePath == filePath); if (rfi == null) { list.Add(new RecentFileInfo() { FilePath = filePath, FileName = fileName, IsPined = false, LastAccess = DateTime.Now }); Messenger.Default.Send <List <RecentFileInfo> >(list, ViewModelBaseMessages.RecentListChanged); } else { rfi.LastAccess = DateTime.Now; Messenger.Default.Send <RecentFileInfo>(rfi, ViewModelBaseMessages.RecentFileChanged); } //check the max int execiding = list.Count - Settings.MaxRecentFile; if (execiding > 0) { List <RecentFileInfo> temp = new List <RecentFileInfo>(); temp.AddRange(list.OrderBy(o => o.LastAccess).Where(p => p.IsPined == false)); for (int i = 0; i < execiding; i++) { list.Remove(temp[i]); } Messenger.Default.Send <List <RecentFileInfo> >(list, ViewModelBaseMessages.RecentListChanged); } } catch (Exception err) { LogHelper.Manage("WorkspaceService.Add", err); } LogHelper.End("WorkspaceService.Add"); }
public void OpenRecentItem(RecentFileInfo recentFileInfo) { if (recentFileInfo == null) { return; } if (recentFileInfo.FileNotFound.HasValue && recentFileInfo.FileNotFound == true) { var message = $"File {recentFileInfo.FullPath} not found.\n\nRemove from list?"; if (_viewInteractionResolver.ShowConfirm(message, "File not found!")) { RemoveFromList(recentFileInfo); } return; } _databaseInteractions.OpenDatabase(recentFileInfo.FullPath); }
private void CatalogButton_Click(object sender, RoutedEventArgs e) { if (LogHelper.CanDebug()) { LogHelper.Begin("RecentFileView.CatalogButton_Click"); } try { MainViewModel mvm = Application.Current.MainWindow.DataContext as MainViewModel; RecentFileInfo rfi = ((RecentFileInfoViewModel)(sender as Button).Tag).Data; mvm.BackStageIsOpen = false; mvm.CatalogOpenFileCommand.Execute(System.IO.Path.Combine(rfi.FilePath, rfi.FileName)); } catch (Exception err) { LogHelper.Manage("RecentFileView.CatalogButton_Click", err); } finally { LogHelper.End("RecentFileView.CatalogButton_Click"); } }
public bool CanUnPinItem(RecentFileInfo recentFileInfo) { return(recentFileInfo != null && recentFileInfo.IsFixed); }