Ejemplo n.º 1
0
 public RecentFileInfoViewModel(RecentFileInfo rfi)
 {
     if (rfi != null)
     {
         Data = rfi;
     }
 }
Ejemplo n.º 2
0
 public void CopyPath(RecentFileInfo recentFileInfo)
 {
     if (recentFileInfo != null)
     {
         _viewInteractionResolver.PutClipboardText(recentFileInfo.FullPath);
     }
 }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
 public void RevealInExplorer(RecentFileInfo recentFileInfo)
 {
     if (recentFileInfo != null)
     {
         _viewInteractionResolver.RevealInExplorer(recentFileInfo.FullPath);
     }
 }
Ejemplo n.º 5
0
 public void UnPinItem(RecentFileInfo recentFileInfo)
 {
     if (recentFileInfo != null)
     {
         PathDefinitions.SetRecentFileFixed(recentFileInfo.FullPath, false);
     }
 }
Ejemplo n.º 6
0
 public void RemoveFromList(RecentFileInfo recentFileInfo)
 {
     if (recentFileInfo != null)
     {
         PathDefinitions.RemoveRecentFile(recentFileInfo.FullPath);
     }
 }
Ejemplo n.º 7
0
        public async Task OpenRecentItem(RecentFileInfo info)
        {
            if (info == null)
            {
                return;
            }

            await _databaseInteractions.OpenDatabase(info.FullPath);
        }
Ejemplo n.º 8
0
        public void OpenRecentItem(RecentFileInfo info)
        {
            if (info == null)
            {
                return;
            }

            _databaseInteractions.OpenDatabase(info.FullPath);
        }
Ejemplo n.º 9
0
        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");
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        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");
            }
        }
Ejemplo n.º 12
0
 public bool CanUnPinItem(RecentFileInfo recentFileInfo)
 {
     return(recentFileInfo != null && recentFileInfo.IsFixed);
 }