protected static void TestWrongContext (IContextAction action, string input) { var context = new TestRefactoringContext (input); if (!action.IsValid (context)) Console.WriteLine ("invalid node is:" + context.GetNode ()); Assert.IsTrue (!action.IsValid (context), action.GetType () + " shouldn't be valid there."); }
/// <summary> /// Register a Context Action /// </summary> /// <param name="handler"></param> public void DeregisterContextAction(IContextAction handler) { lock (contextEventHandlers) { contextEventHandlers.Remove(handler); } }
/// <summary> /// Loads context actions /// </summary> /// <param name="type">Type to try to load</param> /// <returns>True if useful types were found and loaded</returns> public bool LoadType(Type type) { if (typeof(IContextAction).IsAssignableFrom(type) && type != typeof(ContextAction)) { try { var c = type.GetConstructor(new Type[] { typeof(RadegastInstance) }); if (c != null) { IContextAction plug = (IContextAction)c.Invoke(new object[] { instance }); RegisterContextAction(plug); return(true); } c = type.GetConstructor(Type.EmptyTypes); if (c != null) { IContextAction plug = (IContextAction)c.Invoke(new object[0]); RegisterContextAction(plug); return(true); } } catch (Exception ex) { Logger.Log("ERROR in Radegast Command: " + type + " because " + ex.Message + " " + ex.StackTrace, Helpers.LogLevel.Debug); throw; } } return(false); }
public ContextActionCommand(IContextAction action, EditorRefactoringContext context) { if (action == null) throw new ArgumentNullException("action"); this.action = action; this.context = context; }
public void SetVisible(IContextAction action, bool isVisible) { IContextActionProvider provider; if (providerForAction.TryGetValue(action, out provider)) { provider.IsVisible = isVisible; } SaveProviderVisibilities(providers); }
public ContextActionCommand(IContextAction action) { if (action == null) { throw new ArgumentNullException("action"); } this.action = action; }
public void RegisterContextAction(IContextAction handler) { lock (contextEventHandlers) { handler.IContextAction(instance); contextEventHandlers.Add(handler); } }
public ContextActionViewModel(IContextAction action, EditorRefactoringContext context) { if (action == null) throw new ArgumentNullException("action"); this.IsVisible = true; this.context = context; this.Action = action; }
public ContextActionViewModel(IContextAction action) { if (action == null) { throw new ArgumentNullException("action"); } this.Action = action; }
public ContextActionCommand(IContextAction action, EditorRefactoringContext context) { if (action == null) { throw new ArgumentNullException("action"); } this.action = action; this.context = context; }
protected static void TestWrongContext(IContextAction action, string input) { var context = new TestRefactoringContext(input); if (!action.IsValid(context)) { Console.WriteLine("invalid node is:" + context.GetNode()); } Assert.IsTrue(!action.IsValid(context), action.GetType() + " shouldn't be valid there."); }
public void SetVisible(IContextAction action, bool isVisible) { IContextActionsProvider provider; if (providerForAction.TryGetValue(action, out provider)) { provider.IsVisible = isVisible; } ContextActionsService.Instance.SaveProviderVisibilities(); }
public ContextActionViewModel(IContextAction action, EditorRefactoringContext context) { if (action == null) { throw new ArgumentNullException("action"); } this.IsVisible = true; this.context = context; this.Action = action; }
protected static string RunContextAction(IContextAction action, string input) { var context = new TestRefactoringContext (input); if (!action.IsValid (context)) Console.WriteLine ("invalid node is:" + context.GetNode ()); Assert.IsTrue (action.IsValid (context), action.GetType () + " is invalid."); action.Run (context); return context.doc.Text; }
protected static string RunContextAction(IContextAction action, string input) { var context = new TestRefactoringContext(input); if (!action.IsValid(context)) { Console.WriteLine("invalid node is:" + context.GetNode()); } Assert.IsTrue(action.IsValid(context), action.GetType() + " is invalid."); action.Run(context); return(context.doc.Text); }
public bool Login(string suffix, ref string user, ref string name) { bool loggedIn = false; IContextAction action = Access <IContextAction>(); object itemNames = new string[] { "AuthenticateUser.In.ExpectedUserLogOn" }; object itemValues = new string[1]; int actionCoupon = Constants.AuthenticateUserActionAgent; string appSignature = _ParticipantCoupon.ToString() + ((string[])itemNames)[0].ToString(); action.Perform(_ParticipantCoupon, itemNames, itemValues, CreateSignature(appSignature), ref actionCoupon, ref itemNames, ref itemValues); if (itemNames != null) { string[] names = (string[])itemNames; object[] values = (object[])itemValues; for (int i = 0; i < names.Length; i++) { ContextItem item = new ContextItem(names[i], values[i]); if (item.Subject.ToLower() == "authenticateuser" && item.Role.ToLower() == "ou" && item.Name.ToLower() == "status") { loggedIn = item.Value.ToString() == "Pass"; if (!loggedIn) { break; } } if (item.Subject.ToLower() == "authenticateuser" && item.Role.ToLower() == "ou" && item.Name.ToLower() == "logon") { user = item.Value.ToString(); } if (item.Subject.ToLower() == "authenticateuser" && item.Role.ToLower() == "ou" && item.Name.ToLower() == "name") { name = item.Value.ToString(); } } } return(loggedIn); }
public ContextActionViewModel(IContextAction action) { if (action == null) throw new ArgumentNullException("action"); this.Action = action; }
public ContextActionCommand(IContextAction action) { if (action == null) throw new ArgumentNullException("action"); this.action = action; }