Esempio n. 1
0
 private void MenuMainFileSaveSelectedAsClick(object sender, EventArgs e)
 {
     try
     {
         Cursor = Cursors.WaitCursor;
         var selectedFile = solutionExplorer.SelectedFiles.FirstOrDefault();
         if (selectedFile == null)
         {
             return;
         }
         SaveFileDialog ofd = FileUtility.CreateSaveFileDlg(selectedFile.FileSystemPath, "All files (*.*)|*.*");
         if (ofd.ShowDialog(this) == DialogResult.OK)
         {
             selectedFile.SaveAs(ofd.FileName);
         }
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
     finally
     {
         Cursor = Cursors.Default;
     }
 }
Esempio n. 2
0
 private void OnLoaded()
 {
     if (InvokeRequired)
     {
         BeginInvoke(new Action(OnLoaded));
         return;
     }
     try
     {
         Cursor = Cursors.WaitCursor;
         var extension = (Path.GetExtension(_fileSystemPath) ?? "").ToUpperInvariant();
         if (extension == ".RSSLN")
         {
             OpenSolution(_fileSystemPath);
         }
         else if (extension == ".RSPROJ")
         {
             bool solutionFound = false;
             var  fi            = new FileInfo(_fileSystemPath);
             var  paths         = new List <string>();
             paths.Add(fi.Directory.FullName);
             if (fi.Directory.Parent != null)
             {
                 paths.Add(fi.Directory.Parent.FullName);
             }
             foreach (var path in paths)
             {
                 foreach (var solution in Directory.GetFiles(path, "*.rssln"))
                 {
                     if (CrcsSolution.SolutionContainsProject(solution, _fileSystemPath))
                     {
                         OpenSolution(solution);
                         solutionFound = true;
                     }
                 }
             }
             if (!solutionFound)
             {
                 var file = _fileSystemPath.Substring(0, _fileSystemPath.Length - 6) + "rssln";
                 _solution = CrcsSolution.CreateSolution(file);
                 _solution.AddProject(CrcsProject.OpenProject(_fileSystemPath, _solution));
                 solutionExplorer.SetSolution(_solution);
                 solutionExplorer.Refresh();
             }
         }
         else
         {
             OpenFile(_fileSystemPath);
         }
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
     finally
     {
         Cursor = Cursors.Default;
     }
 }
Esempio n. 3
0
 private void MenuProjectEncodeResourcesClick(object sender, EventArgs e)
 {
     try
     {
         MainForm.ProcessFiles(SelectedItems.OfType <CompositFile>(), ProcessingOptions.Encode);
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 4
0
 private void MenuMainProjectProcessClick(object sender, EventArgs e)
 {
     try
     {
         ProcessFiles(null);
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 5
0
 private void OpenRecentFile(MruMenuManager manager, string fileSystemPath)
 {
     try
     {
         OpenFile(fileSystemPath);
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 6
0
 private void MenuMainFileSaveAllClick(object sender, EventArgs e)
 {
     try
     {
         SaveAllFiles();
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 7
0
 private void MenuProjectOpenClick(object sender, EventArgs e)
 {
     try
     {
         MainForm.OpenSelectedFiles();
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 8
0
 private void MenuTabStripCloseAllClick(object sender, EventArgs e)
 {
     try
     {
         CloseOpenFiles();
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 9
0
 private void MenuMainViewDropDownOpening(object sender, EventArgs e)
 {
     try
     {
         menuMainViewRefreshProjectExplorer.Enabled = (_solution != null);
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 10
0
 private void MenuTabStripCloseAllButThisClick(object sender, EventArgs e)
 {
     try
     {
         IProjectFile[] files =
             tabStripMain.Items.Where(p => !p.IsSelected).Select(x => x.Tag).OfType <IProjectFile>().ToArray();
         CloseOpenFiles(files);
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 11
0
 private void MenuMainFileAddNewProjectClick(object sender, EventArgs e)
 {
     try
     {
         if (!AddNewProject())
         {
             return;
         }
         solutionExplorer.Refresh();
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 12
0
 private void MenuProjectRevertClick(object sender, EventArgs e)
 {
     try
     {
         foreach (CompositFile file in SelectedItems.OfType <CompositFile>())
         {
             file.RevertToOriginal();
             RemoveChildNodes(file.TreeNode);
         }
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 13
0
 private void MenuProjectCopyFullPathClick(object sender, EventArgs e)
 {
     try
     {
         if (SelectedNode == null)
         {
             return;
         }
         Clipboard.SetText(SelectedNode.FileSystemPath);
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 14
0
 private void MenuProjectExcludeFromProjectClick(object sender, EventArgs e)
 {
     try
     {
         foreach (ProjectTreeNode node in SelectedNodes)
         {
             SelectedProject.Exclude(node.FileSystemPath);
         }
         Refresh();
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 15
0
 private void MenuProjectOpenContainingFolderClick(object sender, EventArgs e)
 {
     try
     {
         if (SelectedNode == null)
         {
             return;
         }
         Process.Start(SelectedNode.ParentFolder);
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 16
0
 private void MenuMainFileDropDownOpening(object sender, EventArgs e)
 {
     try
     {
         menuMainFileRecentBar.Visible = _recentFiles.Visible || _recentSolutions.Visible;
         bool canSaveSelectedTreeNodes = solutionExplorer.CanSaveSelectedTreeNodes();
         if (canSaveSelectedTreeNodes)
         {
             var selectedFile = solutionExplorer.SelectedFiles.FirstOrDefault();
             if (solutionExplorer.SelectedNodes.Count() == 1 && canSaveSelectedTreeNodes)
             {
                 menuMainFileSaveSelected.Text   = "Save " + selectedFile.RelativePath;
                 menuMainFileSaveSelectedAs.Text = "Save " + selectedFile.RelativePath + " As...";
             }
             else
             {
                 menuMainFileSaveSelected.Text   = "Save Selected Items";
                 menuMainFileSaveSelectedAs.Text = "Save Selected Items As...";
             }
             menuMainFileSaveSelectedAs.Enabled = canSaveSelectedTreeNodes;
             menuMainFileSaveSelected.Enabled   = canSaveSelectedTreeNodes;
         }
         else
         {
             IProjectFile file = GetFileFromTabStripItem();
             if (file == null)
             {
                 menuMainFileSaveSelected.Enabled   = false;
                 menuMainFileSaveSelectedAs.Enabled = false;
                 menuMainFileSaveSelected.Text      = "Save Selected Items";
                 menuMainFileSaveSelectedAs.Text    = "Save Selected Items As...";
             }
             else
             {
                 menuMainFileSaveSelected.Text      = "Save " + file.Name;
                 menuMainFileSaveSelectedAs.Text    = "Save " + file.Name + " As...";
                 menuMainFileSaveSelected.Enabled   = file.CanSave;
                 menuMainFileSaveSelectedAs.Enabled = file.CanSaveAs;
             }
         }
         menuMainFileAdd.Visible    = _solution != null;
         menuMainFileAddBar.Visible = _solution != null;
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 17
0
 private void MenuMainViewShowExcludedClick(object sender, EventArgs e)
 {
     try
     {
         menuMainViewShowExcluded.Checked = !menuMainViewShowExcluded.Checked;
         if (_solution != null)
         {
             _solution.ShowExcludedItems = menuMainViewShowExcluded.Checked;
         }
         solutionExplorer.Refresh();
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 18
0
 private void MenuMainProjectLoadFilesToExcludeClick(object sender, EventArgs e)
 {
     try
     {
         OpenFileDialog ofd = FileUtility.CreateOpenFileDlg("", "List of Files to exclude (*.*)|*.*");
         if (ofd.ShowDialog(this) == DialogResult.OK)
         {
             solutionExplorer.SelectedProject.LoadListWithFilesToExclude(ofd.FileName);
             solutionExplorer.Refresh();
         }
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 19
0
 private void MenuTabStripCopyFullPathClick(object sender, EventArgs e)
 {
     try
     {
         IProjectFile file = GetFileFromTabStripItem();
         if (file == null)
         {
             return;
         }
         Clipboard.SetText(file.FileSystemPath);
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 20
0
 private void MenuTabStripOpenContainingFolderClick(object sender, EventArgs e)
 {
     try
     {
         IProjectFile file = GetFileFromTabStripItem();
         if (file == null)
         {
             return;
         }
         Process.Start(file.ParentFolder);
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 21
0
 private void MenuTabStripCloseClick(object sender, EventArgs e)
 {
     try
     {
         IProjectFile file = GetFileFromTabStripItem();
         if (file == null)
         {
             return;
         }
         CloseOpenFiles(new[] { file });
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 22
0
 private void MenuMainFileAddExistingProjectClick(object sender, EventArgs e)
 {
     try
     {
         OpenFileDialog ofd = FileUtility.CreateOpenFileDlg("", "Crcs project files (*.rsproj)|*.rsproj");
         ofd.DefaultExt = "rsproj";
         if (ofd.ShowDialog(this) == DialogResult.OK)
         {
             _solution.AddProject(CrcsProject.OpenProject(ofd.FileName, _solution));
             solutionExplorer.Refresh();
         }
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 23
0
 private void MenuMainFileSaveSelectedClick(object sender, EventArgs e)
 {
     try
     {
         var selectedFiles = solutionExplorer.SelectedFiles.ToList();
         var file          = GetFileFromTabStripItem();
         if (file != null)
         {
             selectedFiles.Add(file);
         }
         SaveFiles(selectedFiles);
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 24
0
 private void ContextMenuTabStripOpening(object sender, CancelEventArgs e)
 {
     try
     {
         IProjectFile file = GetFileFromTabStripItem();
         if (file == null)
         {
             return;
         }
         menuTabStripSave.Visible = file.CanSave;
         menuTabStripSave.Text    = "Save " + file.RelativePath;
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 25
0
 private void MenuMainFileNewProjectClick(object sender, EventArgs e)
 {
     try
     {
         if (!CreateNewProject())
         {
             return;
         }
         solutionExplorer.SetSolution(_solution);
         solutionExplorer.Refresh();
         _recentSolutions.Add(_solution.FileSystemPath);
         FileUtility.AddToRecentDocuments(_solution.FileSystemPath);
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 26
0
 private void ToolStripStatusButtonClick(object sender, EventArgs e)
 {
     try
     {
         toolStripStatusText.Text          = "Canceling operation...";
         toolStripStatusButton.BorderStyle = Border3DStyle.Sunken;
         _timerToolbarButton          = new Timer();
         _timerToolbarButton.Interval = 1000;
         _timerToolbarButton.Tick    += TimerToolbarButtonTick;
         _timerToolbarButton.Start();
         foreach (BackgroundFileHandler worker in _backgroundWorkers)
         {
             worker.Abort();
         }
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 27
0
 private void MenuMainProjectDeodexClick(object sender, EventArgs e)
 {
     try
     {
         if (_solution.Properties.CanOptimizePng &&
             MessageEngine.AskQuestion(this, "Do you want png files to be optimized", "Deodex...",
                                       MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             ProcessFiles(null, ProcessingOptions.DeOdex | ProcessingOptions.OptimizePng);
         }
         else
         {
             ProcessFiles(null, ProcessingOptions.DeOdex);
         }
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 28
0
 private void MenuMainFileOpenFileClick(object sender, EventArgs e)
 {
     try
     {
         Cursor = Cursors.WaitCursor;
         OpenFileDialog ofd = FileUtility.CreateOpenFileDlg("", "All files (*.*)|*.*");
         if (ofd.ShowDialog(this) == DialogResult.OK)
         {
             OpenFile(ofd.FileName);
         }
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
     finally
     {
         Cursor = Cursors.Default;
     }
 }
Esempio n. 29
0
 private void MenuTabStripSaveClick(object sender, EventArgs e)
 {
     try
     {
         IProjectFile file = GetFileFromTabStripItem();
         if (file == null)
         {
             return;
         }
         if (!file.CanSave)
         {
             return;
         }
         file.Save();
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }
Esempio n. 30
0
 private void TabStripMainTabStripItemMouseUp(object sender, TabStripMouseEventArgs e)
 {
     try
     {
         IProjectFile file = GetFileFromTabStripItem();
         if (file == null)
         {
             menuMainFileSaveSelected.Enabled   = false;
             menuMainFileSaveSelectedAs.Enabled = false;
             return;
         }
         solutionExplorer.SetTreeNodeSelection(file);
         menuMainFileSaveSelected.Enabled   = file.CanSave;
         menuMainFileSaveSelectedAs.Enabled = file.CanSaveAs;
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
 }