本文整理汇总了C#中ExecuteEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ExecuteEventArgs类的具体用法?C# ExecuteEventArgs怎么用?C# ExecuteEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExecuteEventArgs类属于命名空间,在下文中一共展示了ExecuteEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: doubleCommentAction_Execute
void doubleCommentAction_Execute(ExecuteEventArgs ea)
{
var activeTextDocument = CodeRush.Documents.ActiveTextDocument;
if (activeTextDocument == null)
{
return;
}
var selection = activeTextDocument.ActiveViewSelection;
selection.ExtendToWholeLines();
var lang = CodeRush.Language;
var commentedSelection = string.Empty;
var lines = selection.Lines;
foreach (var line in lines)
{
var lineText = line.TrimStart();
var commentLine = lang.GetComment(lang.GetComment(lineText));
var idx = commentLine.LastIndexOf(System.Environment.NewLine);
commentLine = commentLine.Remove(idx);
commentedSelection += commentLine;
}
selection.Text = commentedSelection;
selection.Format();
if (selection.AnchorIsAtEnd)
selection.SwapPoints();
selection.Clear();
}
示例2: TemplateExpandWithCollapsedRegions_Execute
private void TemplateExpandWithCollapsedRegions_Execute(ExecuteEventArgs ea)
{
TextDocument ActiveDoc = CodeRush.Documents.ActiveTextDocument;
using (ActiveDoc.NewCompoundAction("TemplateExpandWithCollapsedRegions"))
{
var LinesFromStart = CodeRush.Caret.Line;
var LinesFromEnd = ActiveDoc.LineCount - LinesFromStart;
DevExpress.CodeRush.Core.Action Action = CodeRush.Actions.Get("TemplateExpand");
Action.DoExecute();
// Calculate line range that template expanded into.
SourceRange TemplateExpandRange = new SourceRange(new SourcePoint(LinesFromStart, 1),
new SourcePoint(ActiveDoc.LineCount - LinesFromEnd,
ActiveDoc.GetLine(LinesFromEnd).Length - 1)
);
// Reparse everything just in case.
CodeRush.Documents.ParseActive();
CodeRush.Documents.ActiveTextDocument.ParseIfTextChanged();
// Execute a delayed collapse of all regions in the ExpansionRange
RangeRegionCollapser Collapser = new RangeRegionCollapser(TemplateExpandRange);
Collapser.PerformDelayedCollapse(150);
}
}
示例3: Login
public void Login(object sender, ExecuteEventArgs args)
{
IsLoading = true;
DidLoginFail = false;
LoginRepository.LoginAsync(
new Models.LoginCredentials(UserName, args.MethodParameter as string),
(result, authToken, ex) =>
{
IsLoading = false;
if (ex == null)
{
DidLoginFail = !result;
if (!DidLoginFail)
{
UserMetaData.AuthToken = authToken;
Bxf.Shell.Instance.ShowView("/Views/Customers.xaml", null, null, null);
}
}
else
{
DidLoginFail = true;
}
});
}
示例4: ExecuteOrganizeWORegions
private void ExecuteOrganizeWORegions(ExecuteEventArgs ea)
{
ClassOrganizer organizer = new ClassOrganizer();
organizer.Organize(CodeRush.Documents.ActiveTextDocument,
CodeRush.Source.ActiveType,
false);
}
示例5: exploreXafErrors_Execute
private void exploreXafErrors_Execute(ExecuteEventArgs ea)
{
Project startUpProject = CodeRush.ApplicationObject.Solution.FindStartUpProject();
Property outPut = startUpProject.ConfigurationManager.ActiveConfiguration.FindProperty(ConfigurationProperty.OutputPath);
Property fullPath = startUpProject.FindProperty(ProjectProperty.FullPath);
string path = Path.Combine(fullPath.Value.ToString(),outPut.Value.ToString());
var reader = new InverseReader(Path.Combine(path,"expressAppFrameWork.log"));
var stackTrace = new List<string>();
while (!reader.SOF) {
string readline = reader.Readline();
stackTrace.Add(readline);
if (readline.Trim().StartsWith("The error occured:")) {
stackTrace.Reverse();
string errorMessage = "";
foreach (string trace in stackTrace) {
errorMessage += trace + Environment.NewLine;
if (trace.Trim().StartsWith("----------------------------------------------------"))
break;
}
Clipboard.SetText(errorMessage);
break;
}
}
reader.Close();
}
示例6: CleanupFileAndNamespaces_Execute
private void CleanupFileAndNamespaces_Execute(ExecuteEventArgs ea)
{
using (var action = CodeRush.Documents.ActiveTextDocument.NewCompoundAction("Cleanup File and Namespaces"))
{
// Store Address
var Address = NavigationServices.GetCurrentAddress();
// Find first NamespaceReference
ElementEnumerable Enumerable =
new ElementEnumerable(CodeRush.Source.ActiveFileNode,
LanguageElementType.NamespaceReference, true);
NamespaceReference Reference = Enumerable.OfType<NamespaceReference>().FirstOrDefault();
if (Reference == null)
{
// No Namespace References to sort.
return;
}
// Move caret
CodeRush.Caret.MoveTo(Reference.Range.Start);
CleanupFile();
InvokeRefactoring();
// Restore Location
NavigationServices.ResolveAddress(Address).Show();
}
}
示例7: MovieSelected
public void MovieSelected(object sender, ExecuteEventArgs args)
{
var movie = args.MethodParameter as Movie;
var message = new ShowViewMessage(MoviesViewTargets.Detail, movie);
MessageBus.Publish<ShowViewMessage>(message);
}
示例8: ReviseSelection_Execute
private void ReviseSelection_Execute(ExecuteEventArgs ea)
{
// Check we have a valid Active TextDocument and TextView
TextDocument activeTextDocument = CodeRush.Documents.ActiveTextDocument;
if (activeTextDocument == null)
return;
TextView activeView = activeTextDocument.ActiveView;
if (activeView == null)
return;
// Extend Selection - This action only works on whole lines.
activeView.Selection.ExtendToWholeLines();
// Get Text in selection
SourceRange activeSelectionRange = activeView.Selection.Range;
string textToDuplicate = activeTextDocument.GetText(activeSelectionRange);
// Remove \r and split on \n - These will be added back later using GetComment
string strippedText = textToDuplicate.Replace("\r", "");
string[] commentedLines = strippedText.Split('\n');
// Build Commented version of code
string commentedCode = String.Empty;
for (int i = 0; i < commentedLines.Length; i++)
if (commentedLines[i] != String.Empty || i != commentedLines.Length - 1)
commentedCode += CodeRush.Language.GetComment(" " + commentedLines[i]);
// BuildReplacement text - Includes CommentedCode and OriginalText
string textToInsert = CodeRush.Language.GetComment(" Old code:") + commentedCode
+ CodeRush.Language.GetComment("-----------") + textToDuplicate;
// Replace originalText with newly built code.
activeTextDocument.SetText(activeSelectionRange, textToInsert);
}
示例9: exploreXafErrors_Execute
private void exploreXafErrors_Execute(ExecuteEventArgs ea) {
Project startUpProject = CodeRush.ApplicationObject.Solution.FindStartUpProject();
Property outPut = startUpProject.ConfigurationManager.ActiveConfiguration.FindProperty(ConfigurationProperty.OutputPath);
bool isWeb = IsWeb(startUpProject);
string fullPath = startUpProject.FindProperty(ProjectProperty.FullPath).Value + "";
string path = Path.Combine(fullPath, outPut.Value.ToString()) + "";
if (isWeb)
path = Path.GetDirectoryName(startUpProject.FullName);
Func<Stream> streamSource = () => {
var path1 = path + "";
File.Copy(Path.Combine(path1, "expressAppFrameWork.log"), Path.Combine(path1, "expressAppFrameWork.locked"), true);
return File.Open(Path.Combine(path1, "expressAppFrameWork.locked"), FileMode.Open, FileAccess.Read, FileShare.Read);
};
var reader = new ReverseLineReader(streamSource);
var stackTrace = new List<string>();
foreach (var readline in reader) {
stackTrace.Add(readline);
if (readline.Trim().StartsWith("The error occured:") || readline.Trim().StartsWith("The error occurred:")) {
stackTrace.Reverse();
string errorMessage = "";
foreach (string trace in stackTrace) {
errorMessage += trace + Environment.NewLine;
if (trace.Trim().StartsWith("----------------------------------------------------"))
break;
}
Clipboard.SetText(errorMessage);
break;
}
}
}
示例10: actReSharperGoToInheritor_Execute
private void actReSharperGoToInheritor_Execute(ExecuteEventArgs ea)
{
if (CodeRush.Source.ActiveMember != null)
CodeRush.Command.Execute("Navigate", "Overrides");
else
CodeRush.Command.Execute("Navigate", "Descendants");
}
示例11: actAddLogging_Execute
private void actAddLogging_Execute(ExecuteEventArgs ea)
{
try
{
Class activeClass = CodeRush.Source.ActiveClass;
//IEnumerable<Method> methods = (IEnumerable<Method>)activeClass.AllMethods;
fileChangeCollection = new FileChangeCollection();
foreach (var method in activeClass.AllMethods)
{
Method methodDetails = (Method)method;
System.Diagnostics.Debug.WriteLine(string.Format("Method: Name:>{0}< Type:>{1}<", methodDetails.Name, methodDetails.MethodType));
AddLoggingToMethod((DevExpress.CodeRush.StructuralParser.Method)method);
}
//Method activeMethod = CodeRush.Source.ActiveMethod;
//AddLoggingToMethod(activeMethod);
CodeRush.File.ApplyChanges(fileChangeCollection);
CodeRush.Source.ParseIfTextChanged();
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
示例12: actQuickPair_Execute
private void actQuickPair_Execute(ExecuteEventArgs ea)
{
string left = actQuickPair.Parameters["Left"].ValueAsStr;
string right = actQuickPair.Parameters["Right"].ValueAsStr;
bool positionCaretBetweenDelimiters = actQuickPair.Parameters["CaretBetween"].ValueAsBool;
if (left.StartsWith("\","))
{
if (right == "true")
positionCaretBetweenDelimiters = true;
right = left.Substring(2).Trim();
left = "\"";
}
TextDocument activeTextDocument = CodeRush.Documents.ActiveTextDocument;
if (activeTextDocument == null)
return;
TextView activeView = activeTextDocument.ActiveView;
if (activeView == null)
return;
TextViewSelection selection = activeView.Selection;
if (selection == null)
return;
TextViewCaret caret = activeView.Caret;
if (caret == null)
return;
if (selection.Exists)
{
Embedding embedding = new Embedding();
embedding.Style = EmbeddingStyle.StartEnd;
string[] top = { left };
string[] bottom = { right };
embedding.Top = top;
embedding.Bottom = bottom;
if (positionCaretBetweenDelimiters)
embedding.AdjustSelection = PostEmbeddingSelectionAdjustment.Leave;
else
embedding.AdjustSelection = PostEmbeddingSelectionAdjustment.Extend;
bool needToMoveCaretToTheRight = false;
if (selection.AnchorPosition < selection.ActivePosition)
needToMoveCaretToTheRight = true;
using (activeTextDocument.NewCompoundAction(STR_EmbedQuickPair))
{
activeTextDocument.EmbedSelection(embedding);
if (needToMoveCaretToTheRight)
{
selection.Set(selection.ActivePosition, selection.AnchorPosition);
}
}
}
else
{
if (CodeRush.Windows.IntellisenseEngine.HasSelectedCompletionSet(activeView))
CodeRush.Command.Execute("Edit.InsertTab");
using (activeTextDocument.NewCompoundAction(STR_QuickPair))
if (positionCaretBetweenDelimiters)
activeTextDocument.ExpandText(caret.SourcePoint, left + "«Caret»«Field()»" + right + "«FinalTarget»");
else
activeTextDocument.InsertText(caret.SourcePoint, left + right);
}
}
示例13: ExecuteCutCurrentMember
private void ExecuteCutCurrentMember(ExecuteEventArgs ea)
{
bool selected =
Utilities.SelectCurrentMember(CodeRush.Caret, CodeRush.Documents.ActiveTextDocument);
if (selected == true)
CodeRush.Clipboard.Cut();
}
示例14: CollapseXML_Execute
private void CollapseXML_Execute(ExecuteEventArgs ea)
{
var Doc = CodeRush.Documents.ActiveTextDocument;
var elements = new ElementEnumerable(Doc.FileNode, LanguageElementType.HtmlElement, true);
foreach (SP.HtmlElement html in elements.OfType<SP.HtmlElement>())
{
var attributes = html.Attributes.OfType<SP.HtmlAttribute>().ToList();
if (attributes.Any(at => at.Name.ToLower() == "id" || at.Name.ToLower() == "name"))
html.CollapseInView(Doc.ActiveView);
}
}
示例15: action1_Execute
private void action1_Execute(ExecuteEventArgs ea)
{
Document currentDocument = CodeRush.Documents == null ? null : CodeRush.Documents.Active;
IMarker marker = CodeRush.Markers.Collect();
if ((marker != null) && (currentDocument != null) &&
!marker.FileName.Equals(currentDocument.FullName, StringComparison.OrdinalIgnoreCase))
{
currentDocument.Close(EnvDTE.vsSaveChanges.vsSaveChangesPrompt);
}
}