private void MainWindow_Closing(object sender, CancelEventArgs e)
 {
     if (((MainWinViewModel)DataContext).IsSessionChanged())
     {
         var result = MessageBox.Show("Session was changed, do you want to save it?", "Session changed", MessageBoxButton.YesNo, MessageBoxImage.Question);
         if (result == MessageBoxResult.Yes)
         {
             MessengerStatic.NotifySessionOverwriting(null);
         }
     }
 }
 public void UnloadSession()
 {
     if (IsSessionLoaded)
     {
         if (IsSessionChanged())
         {
             MessengerStatic.NotifySessionOverwriting(null);
         }
         CurrentSession     = null;
         InitialSession     = null;
         CurrentSessionPath = null;
     }
     LoadDbModels();
     IsSessionLoaded = false;
     WireFilter();
 }
        public void LoadSession(string fileName)
        {
            if (IsSessionChanged())
            {
                MessengerStatic.NotifySessionOverwriting(null);
            }

            CurrentSessionPath = fileName;
            if (!File.Exists(fileName))
            {
                return;
            }
            CurrentSession = XmlSerializerService.DeserializeSession(fileName);
            browserPath    = CurrentSession.BrowserPath;
            TabItems       = CurrentSession.TabItems;

            IsSessionLoaded = true;
            InitialSession  = new Session(CurrentSession);

            TabsHistory.Insert(0, new HistoryItem(CurrentSessionPath));
            CompressTabsHisotry();

            WireFilter();
        }