Пример #1
0
 public override void SaveSettings()
 {
     base.SaveSettings();
     settings.Save();
     copyBookmarksToSettings();
     if (preview != null)
     {
         settings.Set<System.Drawing.Rectangle>(GrepSettings.Key.PreviewWindowSize, preview.StickyWindow.OriginalForm.Bounds);
         settings.Set<StickyWindow.StickDir>(GrepSettings.Key.PreviewWindowPosition, preview.StickyWindow.IsStuckTo(stickyWindow.OriginalForm, true));
         preview.ForceClose();
         preview = null;
     }         
 }
Пример #2
0
 private void previewFile(string filePath, GrepSearchResult result, int line, RectangleF parentWindow)
 {
     if (PreviewFileContent)
     {
         if (previewModel == null)
         {
             previewModel = new PreviewViewModel();
         }
     
         if (preview == null)
         {
             preview = new PreviewView();
             preview.DataContext = previewModel;
             System.Drawing.Rectangle bounds = settings.Get<System.Drawing.Rectangle>(GrepSettings.Key.PreviewWindowSize);
             if (bounds.Left == 0 && bounds.Right == 0)
             {
                 preview.Height = parentWindow.Height;
                 preview.Left = parentWindow.Left + parentWindow.Width;
                 preview.Width = parentWindow.Width;
                 preview.Top = parentWindow.Top;
             }
             else
             {
                 var stickyDir = GrepSettings.Instance.Get<StickyWindow.StickDir>(GrepSettings.Key.PreviewWindowPosition);
                 bounds = StickyWindow.PositionRelativeTo(stickyWindow.OriginalForm, stickyDir, bounds);
                 preview.Height = bounds.Height;
                 preview.Left = bounds.Left;
                 preview.Width = bounds.Width;
                 preview.Top = bounds.Top;
             }
         }
         previewModel.GrepResult = result;
         previewModel.LineNumber = line;
         previewModel.FilePath = filePath;
         preview.Show();
     }  
 }