当前位置: 首页>>代码示例>>C#>>正文


C# IAction.GetType方法代码示例

本文整理汇总了C#中IAction.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IAction.GetType方法的具体用法?C# IAction.GetType怎么用?C# IAction.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAction的用法示例。


在下文中一共展示了IAction.GetType方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Add

        public void Add(IAction action)
        {
            if(action.GetType() == typeof(SelectionAction) && firstSelectionAction == null)
                firstSelectionAction = (SelectionAction)action;
            else if (action.GetType() == typeof(BiomeAction) && firstBiomeAction == null)
                firstBiomeAction = (BiomeAction)action;
            else if (action.GetType() == typeof(PopulateAction) && firstPopulateAction == null)
                firstPopulateAction = (PopulateAction)action;

            //ensure the first action of each type isn't lost when the redo stack is emptied
            if(firstSelectionAction != null && action != firstSelectionAction && redoStack.Contains(firstSelectionAction))
            {
                redoStack.Remove(firstSelectionAction);
                undoStack.AddLast(firstSelectionAction);
            }
            if (firstBiomeAction != null && action != firstBiomeAction && redoStack.Contains(firstBiomeAction))
            {
                redoStack.Remove(firstBiomeAction);
                undoStack.AddLast(firstBiomeAction);
            }
            if (firstPopulateAction != null && action != firstPopulateAction && redoStack.Contains(firstPopulateAction))
            {
                redoStack.Remove(firstPopulateAction);
                undoStack.AddLast(firstPopulateAction);
            }

            action.PreviousAction = GetPreviousAction(undoStack.Last, action.GetType());
            undoStack.AddLast(action);
            foreach (IAction a in redoStack)
                a.Dispose();
            redoStack.Clear();
        }
开发者ID:mblaine,项目名称:BiomePainter,代码行数:32,代码来源:HistoryManager.cs

示例2: SetProperties

        public static void SetProperties(IAction action)
        {
            foreach (PropertyInfo pi in action.GetType().GetProperties())
            {
                object[] propertyAttributes = pi.GetCustomAttributes(typeof(ActionPropertyAttribute), false);

                if (propertyAttributes.Length == 1)
                {
                    if (action.Fields.ContainsKey(pi.Name))
                    {
                        pi.SetValue(action, Convert.ChangeType(ValueStringEvaluator.Evaluate(action.Fields[pi.Name],
                            action.ParentBuildFile), pi.PropertyType), null);
                        action.Fields.Remove(pi.Name);
                    }
                    else
                    {
                        ActionPropertyAttribute apa = (ActionPropertyAttribute)propertyAttributes[0];

                        if (apa.IsRequired)
                            throw new ActionPropertyNotSetException(action, pi, "The value for a required property was not set.");
                    }
                }
            }

            EvaluateFields(action);
        }
开发者ID:almx,项目名称:CamBuild,代码行数:26,代码来源:ActionPropertySetter.cs

示例3: CanHandle

        public bool CanHandle(IAction action)
        {
            // @todo & typeof is IHandler
            var interfaces = GetType().GetInterfaces();
            var candidates = interfaces.Where(x => x.IsConstructedGenericType 
                                                && x.GetGenericArguments()[0] == action.GetType());

            return candidates.Any();
        }
开发者ID:danbyrne84,项目名称:tinyCQRS,代码行数:9,代码来源:Handler.cs

示例4: log

 bool log(IAction action, bool completed, bool reversed, Exception ex)
 {
     var info = new ActionInfo
     {
         ID = ID,
         BID = BID,
         Order = action.Order,
         Data = action.GetData().Serialize(),
         Result = action.GetResult().Serialize(),
         Action = action.GetType().Name,
         Exception = ex.Serialize(),
         Completed = (ex== null) && completed,
         Reversed = (ex == null) && reversed,
         VersionTime = DateTime.Now,
         IsLast = true
     };
     lock (lockObj)
     {
         actionStore[ID].Actions.Add(info);
     }
     return true;
 }
开发者ID:BikS2013,项目名称:bUtility,代码行数:22,代码来源:Store.cs

示例5: CreateActionView

		private static IActionView CreateActionView(ToolStripKind kind, IAction action, IconSize iconSize)
        {
			IActionView view = null;

            // optimization: for framework-provided actions, we can just create the controls
            // directly rather than use the associated view, which is slower;
            // however, an AssociateViewAttribute should always take precedence.
            if (action.GetType().GetCustomAttributes(typeof(AssociateViewAttribute), true).Length == 0)
            {
				if (kind == ToolStripKind.Toolbar)
				{
					if (action is IDropDownAction)
					{
						if (action is IClickAction)
							view = StandardWinFormsActionView.CreateDropDownButtonActionView();
						else
							view = StandardWinFormsActionView.CreateDropDownActionView();
					}
					else if(action is ITextBoxAction)
						view = StandardWinFormsActionView.CreateTextBoxActionView();
					else if (action is IClickAction)
						view = StandardWinFormsActionView.CreateButtonActionView();
				}
				else
				{
					if (action is IClickAction)
						view = StandardWinFormsActionView.CreateMenuActionView();
				}
            }
			if (view == null)
				view = (IActionView)ViewFactory.CreateAssociatedView(action.GetType());

			view.Context = new ActionViewContext(action, iconSize);
			return view;
		}
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:35,代码来源:ToolStripBuilder.cs

示例6: Do

        /*
         * isCanUndo attribute specifies whether the action can be undo.
         * sometimes an action doesn't need undo even it's a IUndoable action.
         * the action will not be pushed in undo stack after performed immediately.
         */
        private void Do(IAction action, bool perform, bool isCanUndo)
        {
            Logger.Log(LOGKEY, string.Format("{0} action: {1}[{2}]", perform ? "do" : "add", action.GetType().Name, action.GetName()));

            if (BeforePerformAction != null)
            {
                var arg = new ActionEventArgs(action, ActionBehavior.Do);
                BeforePerformAction(this, arg);
                if (arg.Cancel) return;
            }

            if (perform) action.Do();

            if (action is IUndoableAction && isCanUndo)
            {
                redoStack.Clear();
                undoStack.Add(action as IUndoableAction);

                if(undoStack.Count() > capacity)
                {
                    undoStack.RemoveRange(0, undoStack.Count() - capacity);
                    Logger.Log(LOGKEY, "action stack full. remove " + (capacity - undoStack.Count()) + " action(s).");
                }
            }

            if (AfterPerformAction != null) AfterPerformAction(this, new ActionEventArgs(action, ActionBehavior.Do));
        }
开发者ID:devfinity-fx,项目名称:cpms_z,代码行数:32,代码来源:ActionManager.cs

示例7: Bind

 internal virtual void Bind(ITaskDefinition iTaskDef) {
     var iActions = iTaskDef.Actions;
     switch (GetType().Name) {
         case "ComHandlerAction":
             iAction = iActions.Create(TaskActionType.ComHandler);
             break;
         case "ExecAction":
             iAction = iActions.Create(TaskActionType.Execute);
             break;
         case "EmailAction":
             iAction = iActions.Create(TaskActionType.SendEmail);
             break;
         case "ShowMessageAction":
             iAction = iActions.Create(TaskActionType.ShowMessage);
             break;
         default:
             throw new ArgumentException();
     }
     Marshal.ReleaseComObject(iActions);
     foreach (var key in unboundValues.Keys) {
         try {
             iAction.GetType().InvokeMember(key, BindingFlags.SetProperty, null, iAction, new[] {
                 unboundValues[key]
             });
         } catch (TargetInvocationException tie) {
             throw tie.InnerException;
         } catch {
         }
     }
     unboundValues.Clear();
 }
开发者ID:roomaroo,项目名称:coapp.powershell,代码行数:31,代码来源:Action.cs

示例8: SetAction

        /// <summary>
        /// Populate the IResourceAction with the IAction
        /// </summary>
        /// <param name="action">The action being used to populate the ResourceAction</param>
        public void SetAction(IAction action)
        {
            m_supportsMime = false;
            m_supportsContainers = false;

            if (string.IsNullOrEmpty(action.Name))
                m_name = "Action_" + Guid.NewGuid().ToString();
            else
                m_name = action.Name;

            List<RunAt> executionTargets = new List<RunAt>(action.Runat);

            m_runAtCapabilities = executionTargets.ToArray();
            m_runAtSetting = executionTargets.ToArray();


            List<ChannelType> supportedChannels = new List<ChannelType>(action.SupportedChannels);


            m_SupportedFileCollectionCapabilities = SupportedFileSet.CreateFileCollection("");
            m_SupportedFileCollectionSetting = SupportedFileSet.CreateFileCollection("");
            if (action.SupportedFileCollection.IsNonSupportedCollection)
            {
                m_SupportedFileCollectionCapabilities.AddSupportFor(".*");
                m_SupportedFileCollectionSetting.AddSupportFor(".*");
            }
            foreach (string s in action.SupportedFileCollection)
            {
                if (action.SupportedFileCollection.IsNonSupportedCollection)
                {
                    m_SupportedFileCollectionCapabilities.RemoveSupportFor(s);
                    m_SupportedFileCollectionSetting.RemoveSupportFor(s);
                }
                else
                {
                    m_SupportedFileCollectionSetting.AddSupportFor(s);
                    m_SupportedFileCollectionCapabilities.AddSupportFor(s);
                    if (s == ".email")
                        m_supportsMime = true;
                    if (s == ".fld")
                        m_supportsContainers = true;
                }
            }
            
            List<PolicyType> policyTypes = new List<PolicyType>();
            foreach (ChannelType channel in supportedChannels)
            {
                PolicyType p = ChannelTypeMappings.Lookup[channel];
                policyTypes.Add(p);
            }

            this.SupportedPolicySetting = policyTypes.ToArray();
            

            m_isExplicit = false;
            m_languageSupport = action.LanguageSupport;
            m_canCoexist = !action.GetType().FullName.StartsWith("Workshare.Policy.Actions.BlockUserAction");
            m_template = false;
            m_blocking = false; //block action has been migrated
            
        }
开发者ID:killbug2004,项目名称:WSProf,代码行数:65,代码来源:ResourceAction.cs

示例9: ActionObject

 /// <summary>
 /// </summary>
 public ActionObject(IAction obj, string name)
 {
     m_Object = obj;
     m_Name = name;
     m_Type = obj.GetType().FullName;
 }
开发者ID:killbug2004,项目名称:WSProf,代码行数:8,代码来源:ActionObject.cs

示例10: SetActionInputPropertyValues

        private static void SetActionInputPropertyValues(ActionInfo actionDefinition, IAction action, Dictionary<string, object> propertyCache)
        {
            foreach (var property in actionDefinition.InputProperties)
            {
                var propertyInfo = GetSetPropertyInfo(action.GetType(), property.Name, actionDefinition.Id);

                object expandedValue;
                
                try
                {
                    expandedValue = ExpandMacros(property.Value, propertyCache);
                }
                catch (Exception e)
                {
                    var message = string.Format("Can't expand macros for property '{0}' in action '{1}'. {2}", property.Name, actionDefinition.Id, e.Message);
                    throw new InvalidDataException(message, e);
                }

                if (!propertyInfo.PropertyType.IsInstanceOfType(expandedValue))
                {
                    expandedValue = Convert.ChangeType(expandedValue, propertyInfo.PropertyType);
                }

                propertyInfo.SetValue(action, expandedValue);
            }
        }
开发者ID:HansKindberg-Net,项目名称:TFS-Branch-Tool,代码行数:26,代码来源:ActionExecutionEngine.cs

示例11: GetActionOutputPropertyValues

 private static void GetActionOutputPropertyValues(ActionInfo actionDefinition, IAction action, Dictionary<string, object> propertyCache)
 {
     foreach (var outPropertyRow in actionDefinition.OutputProperties)
     {
         var propertyName = outPropertyRow.Name;
         var propertyInfo = GetGetPropertyInfo(action.GetType(), propertyName, actionDefinition.Id);
         var propertyValue = propertyInfo.GetValue(action);
         propertyCache.Add(GetPropertyMacroName(actionDefinition.Id, propertyName), propertyValue);
     }
 }
开发者ID:HansKindberg-Net,项目名称:TFS-Branch-Tool,代码行数:10,代码来源:ActionExecutionEngine.cs

示例12: HasHttpMethod

 private static bool HasHttpMethod(IAction action, HttpVerbs httpVerb) {
     return action.GetType().GetMethods().ToList().Find(
                x => x.Name.ToLowerInvariant() == Enum.GetName(typeof(HttpVerbs), httpVerb).ToLowerInvariant()) != null;
 }
开发者ID:szp11,项目名称:Martin,代码行数:4,代码来源:ActionInvoker.cs

示例13: GetMethod

 private static MethodInfo GetMethod(IAction action, HttpVerbs httpVerb) {
     return action.GetType().GetMethods().ToList().Find(
         x => x.Name.ToUpperInvariant() == Enum.GetName(typeof(HttpVerbs), httpVerb));
 }
开发者ID:szp11,项目名称:Martin,代码行数:4,代码来源:ActionInvoker.cs


注:本文中的IAction.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。