public override void Save(OpenedFile file, Stream stream) { AnalyticsMonitorService.TrackFeature(typeof(HexEditView), "Save"); this.hexEditContainer.SaveFile(file, stream); this.TitleName = Path.GetFileName(file.FileName); this.TabPageText = this.TitleName; }
/// <summary> /// Starts to run a build inside the SharpDevelop GUI. /// Only one build can run inside the GUI at one time. /// </summary> /// <param name="project">The project/solution to build.</param> /// <param name="options">The build options.</param> public static void BuildInGui(IBuildable project, BuildOptions options) { if (project == null) { throw new ArgumentNullException("project"); } if (options == null) { throw new ArgumentNullException("options"); } WorkbenchSingleton.AssertMainThread(); if (guiBuildCancellation != null) { BuildResults results = new BuildResults(); WorkbenchSingleton.StatusBar.SetMessage(Core.ResourceService.GetString("MainWindow.CompilerMessages.MSBuildAlreadyRunning")); BuildError error = new BuildError(null, Core.ResourceService.GetString("MainWindow.CompilerMessages.MSBuildAlreadyRunning")); results.Add(error); TaskService.Add(new Task(error)); results.Result = BuildResultCode.MSBuildAlreadyRunning; if (options.Callback != null) { options.Callback(results); } } else { guiBuildCancellation = new CancellationTokenSource(); IProgressMonitor progressMonitor = WorkbenchSingleton.StatusBar.CreateProgressMonitor(guiBuildCancellation.Token); guiBuildTrackedFeature = AnalyticsMonitorService.TrackFeature("ICSharpCode.SharpDevelop.Project.BuildEngine.Build"); WorkbenchSingleton.StatusBar.SetMessage(StringParser.Parse("${res:MainWindow.CompilerMessages.BuildVerb}...")); ProjectService.RaiseEventBuildStarted(new BuildEventArgs(project, options)); StartBuild(project, options, new MessageViewSink(TaskService.BuildMessageViewCategory, progressMonitor, WorkbenchSingleton.StatusBar)); } }
void DecompilationThread() { try { StringWriter writer = new StringWriter(); RunDecompiler(assemblyFile, fullTypeName, new DebuggerTextOutput(new PlainTextOutput(writer)), cancellation.Token); if (!cancellation.IsCancellationRequested) { WorkbenchSingleton.SafeThreadAsyncCall(OnDecompilationFinished, writer); } } catch (OperationCanceledException) { // ignore cancellation } catch (Exception ex) { if (cancellation.IsCancellationRequested) { MessageService.ShowException(ex); return; } AnalyticsMonitorService.TrackException(ex); StringWriter writer = new StringWriter(); writer.WriteLine(string.Format("Exception while decompiling {0} ({1})", fullTypeName, assemblyFile)); writer.WriteLine(); writer.WriteLine(ex.ToString()); WorkbenchSingleton.SafeThreadAsyncCall(OnDecompilationFinished, writer); } }
public AvalonEditViewContent(OpenedFile file, Encoding fixedEncodingForLoading = null) { if (fixedEncodingForLoading != null) { codeEditor.UseFixedEncoding = true; codeEditor.PrimaryTextEditor.Encoding = fixedEncodingForLoading; } this.TabPageText = "${res:FormsDesigner.DesignTabPages.SourceTabPage}"; if (file.FileName != null) { string filetype = Path.GetExtension(file.FileName); if (!ProjectService.GetFileFilters().Any(f => f.ContainsExtension(filetype))) { filetype = ".?"; } trackedFeature = AnalyticsMonitorService.TrackFeature(typeof(AvalonEditViewContent), "open" + filetype.ToLowerInvariant()); } this.Files.Add(file); file.ForceInitializeView(this); file.IsDirtyChanged += PrimaryFile_IsDirtyChanged; codeEditor.Document.UndoStack.PropertyChanged += codeEditor_Document_UndoStack_PropertyChanged; codeEditor.CaretPositionChanged += CaretChanged; codeEditor.TextCopied += codeEditor_TextCopied; }
/// <summary> /// Saves the content to the location <code>fileName</code> /// </summary> /// <remarks> /// When the user switches between multiple views editing the same file, a view /// change will trigger one view content to save that file into a memory stream /// and the other view content will load the file from that memory stream. /// </remarks> public override void Save(OpenedFile file, Stream stream) { AnalyticsMonitorService.TrackFeature(typeof(XmlEditorView), "Save"); viewModel.SaveModelToXmlModel(file, stream); this.TitleName = Path.GetFileName(file.FileName); this.TabPageText = this.TitleName; }
protected override void OnClick() { string feature = GetFeatureName(); if (!string.IsNullOrEmpty(feature)) { AnalyticsMonitorService.TrackFeature(feature, "Toolbar"); } base.OnClick(); }
protected override void OnClick() { base.OnClick(); string feature = GetFeatureName(); if (!string.IsNullOrEmpty(feature)) { AnalyticsMonitorService.TrackFeature(feature, ActivationMethod); } }
public virtual void MouseDown(MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left) { var f = AnalyticsMonitorService.TrackFeature("ICSharpCode.SharpDevelop.Bookmarks.ClassMemberBookmark.ShowContextMenu"); var ctx = MenuService.ShowContextMenu(e.Source as UIElement, this, ContextMenuPath); ctx.Closed += delegate { f.EndTracking(); }; e.Handled = true; } }
private static void OnDebugStarting(object sender, EventArgs e) { debugFeature = AnalyticsMonitorService.TrackFeature("Debugger"); ClearDebugMessages(); if (DebugStarting != null) { DebugStarting(null, e); } }
public HexEditView(OpenedFile file) { hexEditContainer = new HexEditContainer(); hexEditContainer.hexEditControl.DocumentChanged += new EventHandler(DocumentChanged); this.Files.Add(file); file.ForceInitializeView(this); AnalyticsMonitorService.TrackFeature(typeof(HexEditView)); }
void membersComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e) { EntityItem item = membersComboBox.SelectedItem as EntityItem; if (item != null) { IMember member = item.Entity as IMember; if (member != null && jumpOnSelectionChange) { AnalyticsMonitorService.TrackFeature(GetType(), "JumpToMember"); JumpTo(item, member.Region); } } }
static void OnDebugStarting(object sender, EventArgs e) { WorkbenchSingleton.Workbench.WorkbenchLayout.StoreConfiguration(); LayoutConfiguration.CurrentLayoutName = "Debug"; debugFeature = AnalyticsMonitorService.TrackFeature("Debugger"); ClearDebugMessages(); if (DebugStarting != null) { DebugStarting(null, e); } }
protected override void OnClick(EventArgs e) { base.OnClick(e); if (menuCommand == null) { menuCommand = (ICommand)codon.AddIn.CreateObject(codon.Properties["class"]); } if (menuCommand != null) { menuCommand.Owner = caller; AnalyticsMonitorService.TrackFeature(menuCommand.GetType().FullName, "Toolbar"); menuCommand.Run(); } }
protected override void OnClick(System.EventArgs e) { base.OnClick(e); if (codon != null) { if (GetVisible() && Enabled) { ICommand cmd = Command; if (cmd != null) { AnalyticsMonitorService.TrackFeature(cmd.GetType().FullName, "Menu"); cmd.Run(); } } } }
static void ShowErrorBox(Exception exception, string message, bool mustTerminate) { if (exception == null) { throw new ArgumentNullException("exception"); } // ignore reentrant calls (e.g. when there's an exception in OnRender) if (showingBox) { return; } showingBox = true; try { try { AnalyticsMonitorService.TrackException(exception); } catch (Exception ex) { LoggingService.Warn("Error tracking exception", ex); } using (ExceptionBox box = new ExceptionBox(exception, message, mustTerminate)) { if (ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.InvokeRequired) { box.ShowDialog(); } else { box.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainWin32Window); } } } catch (Exception ex) { LoggingService.Warn("Error showing ExceptionBox", ex); MessageBox.Show(exception.ToString(), message, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } finally { showingBox = false; } }
void classComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e) { // The selected class was changed. // Update the list of member items to be the list of members of the current class. EntityItem item = classComboBox.SelectedItem as EntityItem; IClass selectedClass = item != null ? item.Entity as IClass : null; memberItems = new List <EntityItem>(); if (selectedClass != null) { IClass compoundClass = selectedClass.GetCompoundClass(); foreach (var m in compoundClass.Methods) { AddMember(selectedClass, m, m.IsConstructor ? TYPE_CONSTRUCTOR : TYPE_METHOD); } foreach (var m in compoundClass.Properties) { AddMember(selectedClass, m, TYPE_PROPERTY); } foreach (var m in compoundClass.Fields) { AddMember(selectedClass, m, TYPE_FIELD); } foreach (var m in compoundClass.Events) { AddMember(selectedClass, m, TYPE_EVENT); } memberItems.Sort(); if (jumpOnSelectionChange) { AnalyticsMonitorService.TrackFeature(GetType(), "JumpToClass"); JumpTo(item, selectedClass.Region); } } membersComboBox.ItemsSource = memberItems; }
public void Execute(object parameter) { AnalyticsMonitorService.TrackFeature(featureName, "Shortcut"); baseCommand.Execute(parameter); }
void ShowInconsistentWarning(bool preferUnixNewLines) { if (editor.Document == null) { return; // editor was disposed } groupBox = new GroupBox(); groupBox.Background = SystemColors.WindowBrush; groupBox.Foreground = SystemColors.WindowTextBrush; groupBox.Header = ResourceService.GetString("AddIns.AvalonEdit.InconsistentNewlines.Header"); groupBox.HorizontalAlignment = HorizontalAlignment.Right; groupBox.VerticalAlignment = VerticalAlignment.Bottom; groupBox.MaxWidth = 300; groupBox.Margin = new Thickness(0, 0, 20, 20); Grid.SetRow(groupBox, 1); windows = new RadioButton { IsChecked = !preferUnixNewLines, Content = ResourceService.GetString("Dialog.Options.IDEOptions.LoadSaveOptions.WindowsRadioButton"), Margin = new Thickness(0, 0, 8, 0) }; unix = new RadioButton { IsChecked = preferUnixNewLines, Content = ResourceService.GetString("Dialog.Options.IDEOptions.LoadSaveOptions.UnixRadioButton") }; normalizeButton = new Button { Content = ResourceService.GetString("AddIns.AvalonEdit.InconsistentNewlines.Normalize") }; cancelButton = new Button { Content = ResourceService.GetString("Global.CancelButtonText") }; groupBox.Content = new StackPanel { Children = { new TextBlock { Text = ResourceService.GetString("AddIns.AvalonEdit.InconsistentNewlines.Description"), TextWrapping = TextWrapping.WrapWithOverflow }, windows, unix, new StackPanel { Margin = new Thickness(0, 2, 0, 0), Orientation = Orientation.Horizontal, Children = { normalizeButton, cancelButton } } } }; editor.Children.Add(groupBox); var featureUse = AnalyticsMonitorService.TrackFeature(typeof(NewLineConsistencyCheck)); EventHandler removeWarning = null; removeWarning = delegate { editor.Children.Remove(groupBox); editor.PrimaryTextEditor.TextArea.Focus(); editor.LoadedFileContent -= removeWarning; featureUse.EndTracking(); }; editor.LoadedFileContent += removeWarning; cancelButton.Click += delegate { AnalyticsMonitorService.TrackFeature(typeof(NewLineConsistencyCheck), "cancelButton"); removeWarning(null, null); }; normalizeButton.Click += delegate { AnalyticsMonitorService.TrackFeature(typeof(NewLineConsistencyCheck), "normalizeButton"); removeWarning(null, null); TextDocument document = editor.Document; string newNewLine = (unix.IsChecked == true) ? "\n" : "\r\n"; using (document.RunUpdate()) { for (int i = 1; i <= document.LineCount; i++) { // re-fetch DocumentLine for every iteration because we're modifying the newlines so that DocumentLines might get re-created DocumentLine line = document.GetLineByNumber(i); if (line.DelimiterLength > 0) { int endOffset = line.EndOffset; if (document.GetText(endOffset, line.DelimiterLength) != newNewLine) { document.Replace(endOffset, line.DelimiterLength, newNewLine); } } } } }; }
public override void Load(OpenedFile file, Stream stream) { AnalyticsMonitorService.TrackFeature(typeof(HexEditView), "Load"); this.hexEditContainer.LoadFile(file, stream); }
/// <summary> /// Load or reload the content of the specified file from the stream. /// </summary> /// <remarks> /// When the user switches between multiple views editing the same file, a view /// change will trigger one view content to save that file into a memory stream /// and the other view content will load the file from that memory stream. /// </remarks> public override void Load(OpenedFile file, Stream stream) { AnalyticsMonitorService.TrackFeature(typeof(XmlEditorView), "Load"); viewModel.LoadModelFromXmlModel(file, stream); }