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; } }
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; } }
private void MenuProjectEncodeResourcesClick(object sender, EventArgs e) { try { MainForm.ProcessFiles(SelectedItems.OfType <CompositFile>(), ProcessingOptions.Encode); } catch (Exception ex) { MessageEngine.ShowError(ex); } }
private void MenuMainProjectProcessClick(object sender, EventArgs e) { try { ProcessFiles(null); } catch (Exception ex) { MessageEngine.ShowError(ex); } }
private void OpenRecentFile(MruMenuManager manager, string fileSystemPath) { try { OpenFile(fileSystemPath); } catch (Exception ex) { MessageEngine.ShowError(ex); } }
private void MenuMainFileSaveAllClick(object sender, EventArgs e) { try { SaveAllFiles(); } catch (Exception ex) { MessageEngine.ShowError(ex); } }
private void MenuProjectOpenClick(object sender, EventArgs e) { try { MainForm.OpenSelectedFiles(); } catch (Exception ex) { MessageEngine.ShowError(ex); } }
private void MenuTabStripCloseAllClick(object sender, EventArgs e) { try { CloseOpenFiles(); } catch (Exception ex) { MessageEngine.ShowError(ex); } }
private void MenuMainViewDropDownOpening(object sender, EventArgs e) { try { menuMainViewRefreshProjectExplorer.Enabled = (_solution != null); } catch (Exception ex) { MessageEngine.ShowError(ex); } }
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); } }
private void MenuMainFileAddNewProjectClick(object sender, EventArgs e) { try { if (!AddNewProject()) { return; } solutionExplorer.Refresh(); } catch (Exception ex) { MessageEngine.ShowError(ex); } }
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); } }
private void MenuProjectCopyFullPathClick(object sender, EventArgs e) { try { if (SelectedNode == null) { return; } Clipboard.SetText(SelectedNode.FileSystemPath); } catch (Exception ex) { MessageEngine.ShowError(ex); } }
private void MenuProjectExcludeFromProjectClick(object sender, EventArgs e) { try { foreach (ProjectTreeNode node in SelectedNodes) { SelectedProject.Exclude(node.FileSystemPath); } Refresh(); } catch (Exception ex) { MessageEngine.ShowError(ex); } }
private void MenuProjectOpenContainingFolderClick(object sender, EventArgs e) { try { if (SelectedNode == null) { return; } Process.Start(SelectedNode.ParentFolder); } catch (Exception ex) { MessageEngine.ShowError(ex); } }
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); } }
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); } }
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); } }
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); } }
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); } }
private void MenuTabStripCloseClick(object sender, EventArgs e) { try { IProjectFile file = GetFileFromTabStripItem(); if (file == null) { return; } CloseOpenFiles(new[] { file }); } catch (Exception ex) { MessageEngine.ShowError(ex); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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; } }
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); } }
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); } }