Esempio n. 1
0
 private void OpenFile(string filepath)
 {
     try
     {
         Serializer.Deserialize(ref _transportList, filepath);
     }
     catch (FileNotFoundException)
     {
         MessageBox.Show("File do not found, please sure that file does exists", "Error", MessageBoxButtons.OK);
         return;
     }
     catch (DirectoryNotFoundException)
     {
         MessageBox.Show("Directory do not found, please sure that folder does exists", "Error",
                         MessageBoxButtons.OK);
         return;
     }
     catch (SecurityException)
     {
         MessageBox.Show("You do not have an access to the file, please get an " +
                         "administrate permission", "Error", MessageBoxButtons.OK);
         return;
     }
     _filePath = filepath;
     iTransportBindingSource.DataSource = _transportList;
     _projectSavedChanges = true;
     FormNameChanging(_projectSavedChanges);
     LoadRecentFiles(_filePath);
     TransportListGridView.ClearSelection();
 }
Esempio n. 2
0
 public TransportListForm(string[] arguments)
 {
     InitializeComponent();
     _transportList = new List <ITransport>();
     _recentFiles   = new RecentFiles();
     if (arguments.Length > 0)
     {
         OpenFile(arguments[0]);
     }
     else
     {
         iTransportBindingSource.DataSource = _transportList;
         _filePath = null;
     }
     _projectSavedChanges = true;
     _afterSearchChanges  = false;
     _recentFiles.RecentFilesDeserialize();
     if (_recentFiles.GetRecentFilesList().Count > 0)
     {
         LoadRecentFilesToMenu();
     }
     TransportListGridView.ClearSelection();
 }