Beispiel #1
0
        protected bool isContext(ISolutionEvent evt, SolutionEventType type)
        {
            var cfgContext = evt.BuildType;

            // /LC: #799
            if (type == SolutionEventType.SlnOpened)
            {
                if (cfgContext == BuildType.Common)
                {
                    cfgContext = BuildType.Before; // consider it as default type
                }

                if (cfgContext != BuildType.Before &&
                    cfgContext != BuildType.After &&
                    cfgContext != BuildType.BeforeAndAfter)
                {
                    return(false);
                }

                if (CurrentContext == BuildType.Common || // Before & After are not possible at all, e.g. Isolated env etc., thus consider it as any possible
                    cfgContext == BuildType.BeforeAndAfter)
                {
                    return(true);
                }

                if (cfgContext == BuildType.Before || cfgContext == BuildType.After)
                {
                    return(cfgContext == CurrentContext);
                }
            }

            return(cfgContext == BuildType.Common || cfgContext == CurrentContext);
        }
        protected int bindSln(SBEEvent[] evt, SolutionEventType type)
        {
            if (isDisabledAll(evt))
            {
                return(Codes.Success);
            }

            if (!IsAllowActions)
            {
                return(_ignoredAction(type));
            }

            string typeString = SolutionEventType.SlnOpened.ToString();

            foreach (SBEEvent item in evt)
            {
                try {
                    if (Cmd.exec(item, type))
                    {
                        Log.Info("[{0}] finished SBE: `{1}`", typeString, item.Caption);
                    }
                    Status._.add(type, StatusType.Success);
                }
                catch (Exception ex) {
                    Log.Error("[{0}] error: `{1}`", typeString, ex.Message);
                    Status._.add(type, StatusType.Fail);
                }
            }

            return(Status._.contains(type, StatusType.Fail)? Codes.Failed : Codes.Success);
        }
Beispiel #3
0
        /// <summary>
        /// Execution by user.
        /// </summary>
        public void execAction()
        {
            if (SBEItem == null)
            {
                Log.Info("No actions to execution. Add new, then try again.");
                return;
            }
            Actions.ICommand cmd = new Actions.Command
                                   (
                Loader.Env,
                Loader.Soba,
                Loader.Soba.EvMSBuild
                                   );

            ISolutionEvent    evt  = SBEItem;
            SolutionEventType type = SBE.type;

            Log.Info("Action: execute action '{0}':'{1}' manually :: emulate '{2}' event", evt.Name, evt.Caption, type);

            cmd.Env.BuildType = BuildType.Common; //TODO: IBuild.updateBuildType
            try {
                bool res = cmd.exec(evt, type);
                Log.Info("Action: '{0}':'{1}' completed as - '{2}'", evt.Name, evt.Caption, res.ToString());
            }
            catch (Exception ex) {
                Log.Error("Action: '{0}':'{1}' is failed. Error: '{2}'", evt.Name, evt.Caption, ex.Message);
            }
        }
 /// <summary>
 /// New status for Event type
 /// </summary>
 /// <param name="tevent">Event type</param>
 /// <param name="tstatus">Execution status</param>
 public void add(SolutionEventType tevent, StatusType tstatus)
 {
     if(!states.ContainsKey(tevent)) {
         states[tevent] = new SynchronizedCollection<StatusType>();
     }
     states[tevent].Add(tstatus);
 }
Beispiel #5
0
 /// <summary>
 /// New status for Event type
 /// </summary>
 /// <param name="tevent">Event type</param>
 /// <param name="tstatus">Execution status</param>
 public void add(SolutionEventType tevent, StatusType tstatus)
 {
     if (!states.ContainsKey(tevent))
     {
         states[tevent] = new SynchronizedCollection <StatusType>();
     }
     states[tevent].Add(tstatus);
 }
Beispiel #6
0
 /// <summary>
 /// Changing the Enabled staus for all event-items
 /// </summary>
 /// <param name="type"></param>
 /// <param name="status"></param>
 public void enabled(SolutionEventType type, bool status)
 {
     ISolutionEvent[] evt = getEvent(type);
     foreach (ISolutionEvent item in evt)
     {
         item.Enabled = status;
     }
 }
 public void initQueue(SolutionEventType type)
 {
     if (queues.ContainsKey(type))
     {
         return;
     }
     queues[type] = new TQueue();
 }
Beispiel #8
0
 protected virtual ISolutionEvent[] getEvent(SolutionEventType type)
 {
     try {
         return(Settings.Cfg.getEvent(type)); //TODO:
     }
     catch (NotFoundException) {
         throw new NotSupportedOperationException($"The event type '{type}' is not supported yet.");
     }
 }
Beispiel #9
0
 protected void enabled(SolutionEventType type, bool status)
 {
     try {
         logic.enabled(type, status);
     }
     catch (Exception ex) {
         Log.Warn("StatusToolControl: Failed - enabled() for type - '{0}' :: '{1}'", type, ex.Message);
     }
 }
 protected virtual ISolutionEvent[] getEvent(SolutionEventType type)
 {
     try {
         return Settings.Cfg.getEvent(type);
     }
     catch(Exception) {
         throw new NotSupportedOperationException("getEvent: Not yet supported event type - '{0}'", type);
     }
 }
Beispiel #11
0
 protected void restore(SolutionEventType type)
 {
     try {
         logic.restore(type);
     }
     catch (Exception ex) {
         Log.Warn("StatusToolControl: Failed - restore() for type - '{0}' :: '{1}'", type, ex.Message);
     }
 }
Beispiel #12
0
 /// <summary>
 /// Updating status for Event type
 /// </summary>
 /// <param name="tevent">Event type</param>
 /// <param name="index">Position in list</param>
 /// <param name="tstatus">new status</param>
 public void update(SolutionEventType tevent, int index, StatusType tstatus)
 {
     try {
         states[tevent][index] = tstatus;
     }
     catch (Exception ex) {
         Log.Debug("Updating status: '{0}'", ex.Message);
     }
 }
Beispiel #13
0
 /// <summary>
 /// Checking existence of StatusType in the current statuses
 /// </summary>
 /// <param name="tevent">Event type</param>
 /// <param name="type"></param>
 /// <returns>true value if contains</returns>
 public bool contains(SolutionEventType tevent, StatusType type)
 {
     Debug.Assert(states != null);
     if (!states.ContainsKey(tevent))
     {
         return(false);
     }
     return(states[tevent].Contains(type));
 }
Beispiel #14
0
 /// <summary>
 /// Captions for buttons
 /// </summary>
 /// <param name="type"></param>
 /// <param name="selected"></param>
 protected string caption(SolutionEventType type, bool selected)
 {
     try {
         return(logic.caption(type, selected));
     }
     catch (Exception ex) {
         Log.Warn("StatusToolControl: problem with caption '{0}'", ex.Message);
     }
     return(logic.caption(type));
 }
Beispiel #15
0
 protected bool isDisabledAll(SolutionEventType type)
 {
     try {
         return(logic.isDisabledAll(type));
     }
     catch (Exception ex) {
         Log.Warn("StatusToolControl: Failed checking the Enabled status for type - '{0}' :: '{1}'", type, ex.Message);
     }
     return(true);
 }
 private ISolutionEvent getEventByIndex(SolutionEventType type, int index)
 {
     ISolutionEvent[] evt = getEvent(type);
     try {
         return(evt[index - 1]); // starts with 1
     }
     catch (IndexOutOfRangeException) {
         throw new NotFoundException("Incorrect index '{0}' for event type - `{1}`  /{2}", index, type, evt.Length);
     }
 }
Beispiel #17
0
 private ISolutionEvent getEventByIndex(SolutionEventType type, int index)
 {
     ISolutionEvent[] evt = getEvent(type);
     try {
         return(evt[index - 1]); // starts with 1
     }
     catch (IndexOutOfRangeException) {
         throw new NotFoundException(type, $"For index '{index}'  /{evt.Length}", index, evt.Length);
     }
 }
Beispiel #18
0
 /// <summary>
 /// Getting the Execution status by Event type and position in list
 /// </summary>
 /// <param name="tevent">Event type</param>
 /// <param name="index">Position in list</param>
 /// <returns>Executed status</returns>
 public StatusType get(SolutionEventType tevent, int index)
 {
     Debug.Assert(states != null);
     try {
         return(states[tevent][index]);
     }
     catch (Exception) {
         return(StatusType.NotFound);
     }
 }
Beispiel #19
0
 protected void toggleRestored(SolutionEventType type, bool enabled)
 {
     if (enabled)
     {
         restore(type);
     }
     else
     {
         this.enabled(type, false);
     }
     Settings.CfgManager.Config.save();
 }
 /// <summary>
 /// Getting event by type.
 /// </summary>
 /// <param name="type">Available event.</param>
 /// <exception cref="NotFoundException"></exception>
 public ISolutionEvent[] getEvent(SolutionEventType type)
 {
     switch(type)
     {
         case SolutionEventType.Common:
         case SolutionEventType.CommandEvent:
         case SolutionEventType.OWP: {
             return Event;
         }
     }
     throw new NotFoundException("getEvent: Not found event type - '{0}'", type);
 }
 /// <summary>
 /// Provides captions by event type
 /// </summary>
 /// <param name="type"></param>
 public string caption(SolutionEventType type)
 {
     switch(type) {
         case SolutionEventType.OWP: {
             return "Output";
         }
         case SolutionEventType.CommandEvent: {
             return "DTE";
         }
     }
     return type.ToString();
 }
Beispiel #22
0
        /// <summary>
        /// The event by type.
        /// </summary>
        /// <param name="type">Available event.</param>
        /// <exception cref="NotFoundException"></exception>
        public ISolutionEvent[] getEvent(SolutionEventType type)
        {
            switch (type)
            {
            case SolutionEventType.Common:
            case SolutionEventType.CommandEvent:
            case SolutionEventType.OWP: {
                return(Event);
            }
            }

            throw new NotFoundException("getEvent: the event type '{0}' is not found.", type);
        }
Beispiel #23
0
 /// <summary>
 /// Updating status for used event type
 /// </summary>
 /// <param name="btn"></param>
 /// <param name="type"></param>
 protected void update(ToggleButton btn, SolutionEventType type)
 {
     try {
         logic.update(type);
         Application.Current.Dispatcher.BeginInvoke(new Action(() => {
             btn.Content   = caption(type, false);
             btn.IsChecked = !isDisabledAll(type);
         }));
     }
     catch (Exception ex) {
         Log.Warn("StatusToolControl: Failed update for type - '{0}' :: '{1}'", type, ex.Message);
     }
 }
Beispiel #24
0
        /// <inheritdoc cref="ISolutionEvents.getEvent"/>
        /// <exception cref="NotFoundException"></exception>
        public ISolutionEvent[] getEvent(SolutionEventType type)
        {
            switch (type)
            {
            case SolutionEventType.Pre: {
                return(PreBuild);
            }

            case SolutionEventType.Post: {
                return(PostBuild);
            }

            case SolutionEventType.Cancel: {
                return(CancelBuild);
            }

            case SolutionEventType.Warnings: {
                return(WarningsBuild);
            }

            case SolutionEventType.Errors: {
                return(ErrorsBuild);
            }

            case SolutionEventType.OWP: {
                return(OWPBuild);
            }

            case SolutionEventType.Transmitter: {
                return(Transmitter);
            }

            case SolutionEventType.CommandEvent: {
                return(CommandEvent);
            }

            case SolutionEventType.Logging: {
                return(Logging);
            }

            case SolutionEventType.SlnOpened: {
                return(SlnOpened);
            }

            case SolutionEventType.SlnClosed: {
                return(SlnClosed);
            }
            }

            throw new NotFoundException(type);
        }
Beispiel #25
0
        /// <summary>
        /// Provides captions by event type
        /// </summary>
        /// <param name="type"></param>
        public string caption(SolutionEventType type)
        {
            switch (type)
            {
            case SolutionEventType.OWP: {
                return("Output");
            }

            case SolutionEventType.CommandEvent: {
                return("DTE");
            }
            }
            return(type.ToString());
        }
Beispiel #26
0
        /// <summary>
        /// Gets index from defined events
        /// </summary>
        /// <param name="type"></param>
        /// <returns>current position in list of definition</returns>
        public int getDefIndexByEventType(SolutionEventType type)
        {
            int idx = 0;

            foreach (SBEWrap evt in events)
            {
                if (evt.type == type)
                {
                    return(idx);
                }
                ++idx;
            }
            return(-1);
        }
Beispiel #27
0
        public void restore(SolutionEventType type)
        {
            if (status.ContainsKey(type) && status[type] != null)
            {
                ISolutionEvent[] evt = getEvent(type);
                for (int i = 0; i < evt.Length; ++i)
                {
                    evt[i].Enabled = status[type][i];
                }
            }

            if (isDisabledAll(type))
            {
                enabled(type, true);
            }
        }
Beispiel #28
0
        /// <summary>
        /// Provides captions by event type and selection mode
        /// </summary>
        /// <param name="type"></param>
        /// <param name="selected"></param>
        /// <exception cref="Exception"></exception>
        public string caption(SolutionEventType type, bool selected)
        {
            ISolutionEvent[] evt = getEvent(type);
            int enabled          = (evt == null)? 0 : evt.Where(i => i.Enabled).Count();

            if (selected)
            {
                return(String.Format("({0} /{1})", enabled, evt.Length));
            }

            if (enabled < 1)
            {
                return(caption(type));
            }
            return(String.Format("{0} ({1})", caption(type), enabled));
        }
Beispiel #29
0
        protected string stEventItem(SolutionEventType type, IPM pm)
        {
            ILevel level = pm.FirstLevel;

            int            index = -1;
            ISolutionEvent evt;

            if (level.Is(ArgumentType.StringDouble))
            {
                evt = getEventByName(type, (string)level.Args[0].data, out index);
            }
            else if (level.Is(ArgumentType.Integer))
            {
                index = (int)level.Args[0].data;
                evt   = getEventByIndex(type, index);
            }
            else
            {
                throw new PMLevelException(level, "`item( string name | integer index )`");
            }

            // .item(...).

            if (pm.Is(1, LevelType.Property, "Enabled"))
            {
                return(pEnabled(evt, pm.PinTo(2)));
            }
            if (pm.Is(1, LevelType.Method, "run"))
            {
                return(mActionRun(type, evt, pm.PinTo(1)));
            }
            if (pm.Is(1, LevelType.Property, "Status"))
            {
                return(itemStatus(type, index, pm.PinTo(1)));
            }
            if (pm.Is(1, LevelType.Property, "stdout"))
            {
                return(pStdout(evt, pm.PinTo(2)));
            }
            if (pm.Is(1, LevelType.Property, "stderr"))
            {
                return(pStderr(evt, pm.PinTo(2)));
            }

            throw new IncorrectNodeException(pm, 1);
        }
Beispiel #30
0
        protected bool toggleEnabled(SolutionEventType type, bool enabled)
        {
            bool ret;

            if (!enabled)
            {
                this.enabled(type, true);
                ret = true;
            }
            else
            {
                this.enabled(type, false);
                ret = false;
            }
            Settings.CfgManager.Config.save();
            return(ret);
        }
Beispiel #31
0
        protected string itemStatus(SolutionEventType type, int index, IPM pm)
        {
            if (!pm.Is(LevelType.Property, "Status"))
            {
                throw new IncorrectNodeException(pm);
            }

            if (pm.FinalEmptyIs(1, LevelType.Property, "HasErrors"))
            {
                string status = Value.From(Status._.get(type, index) == StatusType.Fail);
#if DEBUG
                Log.Trace($"pStatus: status - '{status}'");
#endif
                return(status);
            }

            throw new IncorrectNodeException(pm, 1);
        }
        /// <param name="type"></param>
        /// <param name="name"></param>
        /// <param name="index">Index of selected type of event by name</param>
        /// <returns></returns>
        private ISolutionEvent getEventByName(SolutionEventType type, string name, out int index)
        {
            if (String.IsNullOrWhiteSpace(name))
            {
                throw new NotFoundException("The name of event type is null or empty.");
            }

            index = -1;
            foreach (ISolutionEvent item in getEvent(type))
            {
                ++index;
                if (item.Name == name)
                {
                    return(item);
                }
            }

            throw new NotFoundException("The event type '{0}' with name '{1}' is not exists.", type, name);
        }
Beispiel #33
0
        /// <param name="type"></param>
        /// <param name="name"></param>
        /// <param name="index">Index of selected type of event by name</param>
        /// <returns></returns>
        private ISolutionEvent getEventByName(SolutionEventType type, string name, out int index)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            index = -1;
            foreach (ISolutionEvent item in getEvent(type))
            {
                ++index;
                if (item.Name == name)
                {
                    return(item);
                }
            }

            throw new NotFoundException(name, $"Event type `{type}`.", type);
        }
            protected override ISolutionEvent[] getEvent(SolutionEventType type)
            {
                if (evt != null)
                {
                    return(evt);
                }

                evt = new SBEEvent[3] {
                    new SBEEvent()
                    {
                        Name              = "Name1",
                        SupportMSBuild    = false,
                        SupportSBEScripts = false,
                        Mode              = new ModeFile()
                        {
                            Command = ""
                        },
                        Enabled = true
                    },
                    new SBEEvent()
                    {
                        Name = "Name2",
                        Mode = new ModeFile()
                        {
                            Command = ""
                        },
                        Enabled = false
                    },
                    new SBEEvent()
                    {
                        Name              = "Name3",
                        SupportMSBuild    = false,
                        SupportSBEScripts = false,
                        BuildType         = Bridge.BuildType.Rebuild,
                        Mode              = new ModeFile()
                        {
                            Command = ""
                        },
                        Enabled = true
                    }
                };
                return(evt);
            }
 /// <summary>
 /// Checking existence of StatusType in the current statuses
 /// </summary>
 /// <param name="tevent">Event type</param>
 /// <param name="type"></param>
 /// <returns>true value if contains</returns>
 public bool contains(SolutionEventType tevent, StatusType type)
 {
     Debug.Assert(states != null);
     if(!states.ContainsKey(tevent)) {
         return false;
     }
     return states[tevent].Contains(type);
 }
 /// <param name="type">Event type</param>
 /// <returns>true value if all event are disabled for present type</returns>
 public bool isDisabledAll(SolutionEventType type)
 {
     return getEvent(type).All(x => !x.Enabled);
 }
        protected string pStatus(SolutionEventType type, int index, string data)
        {
            Match m = Regex.Match(data, @"\.\s*
                                         ([A-Za-z_0-9]+)  #1 - property
                                         \s*$",
                                         RegexOptions.IgnorePatternWhitespace);

            if(!m.Success) {
                throw new OperandNotFoundException("Failed pStatus - '{0}'", data);
            }

            string property = m.Groups[1].Value;
            if(property == "HasErrors")
            {
                string status = (Status._.get(type, index) == StatusType.Fail).ToString().ToLower();
                Log.Debug("pStatus: status - '{0}'", status);
                return status;
            }

            throw new SubtypeNotFoundException("pStatus: not found subtype - '{0}'", property);
        }
        protected string stEventItem(SolutionEventType type, string index, string name, string data)
        {
            Debug.Assert((index == null && name != null) || (index != null && name == null));

            Match m = Regex.Match(data,
                                    String.Format(@"\.\s*
                                                    ([A-Za-z_0-9]+)  #1 - property
                                                    (?:
                                                      \s*\(
                                                      {0}            #2 - arg (optional)
                                                      \)\s*
                                                    )?
                                                    \s*(.*)          #3 - operation
                                                   ", RPattern.DoubleQuotesContent
                                                 ), RegexOptions.IgnorePatternWhitespace);

            if(!m.Success) {
                throw new SyntaxIncorrectException("Failed stEventItem - '{0}'", data);
            }

            string property     = m.Groups[1].Value;
            string operation    = m.Groups[3].Value.Trim();

            Log.Debug("stEventItem: property - '{0}', operation - '{1}'", property, operation);
            int sIndex = -1;
            ISolutionEvent evt = (name != null)? getEventByName(type, name, out sIndex) : getEventByIndex(type, index, out sIndex);

            switch(property)
            {
                case "Enabled": {
                    return pEnabled(evt, operation);
                }
                case "Status": {
                    return pStatus(type, sIndex, operation);
                }
            }
            throw new SubtypeNotFoundException("stEventItem: not found subtype - '{0}'", property);
        }
Beispiel #39
0
        /// <summary>
        /// Implements transport for new action by event type.
        /// </summary>
        /// <param name="type">The type of event.</param>
        /// <param name="cfg">The event configuration for action.</param>
        public void action(SolutionEventType type, ISolutionEvent cfg)
        {
            ISolutionEvent evt = addAction(-1);

            if(evt == null || cfg == null) {
                Log.Debug("UI.action for `{0}` - cfg or evt is null /skip", type);
                return;
            }

            cfg.CloneByReflectionInto(evt, true);

            refreshActions(true);
            refreshSettings();
            notice(true);

            MessageBox.Show(String.Format("The new action `{0}`:\n`{1}` has been added.", evt.Name, evt.Caption), "New action");
        }
 /// <summary>
 /// Updating status for used event type
 /// </summary>
 /// <param name="type"></param>
 public void update(SolutionEventType type)
 {
     if(!isDisabledAll(type)) {
         status[type] = getEvent(type).Select(i => i.Enabled).ToArray();
     }
 }
Beispiel #41
0
        /// <summary>
        /// Entry point for execution
        /// </summary>
        /// <param name="evt">Configured event</param>
        /// <param name="type">Type of event</param>
        /// <returns>true value if has been processed</returns>
        public bool exec(ISolutionEvent evt, SolutionEventType type)
        {
            if(!evt.Enabled){
                return false;
            }
            if(evt.BuildType != BuildType.Common && evt.BuildType != Env.BuildType) {
                Log.Debug("Ignored context. Build type '{0}' should be '{1}'", Env.BuildType, evt.BuildType);
                return false;
            }
            this.type = type;

            if(!confirm(evt)) {
                Log.Debug("Skipped action by user");
                return false;
            }

            Log.Info("Launching action '{0}' :: Configuration - '{1}'", evt.Caption, (Env != null)? Env.SolutionActiveCfgString : "");
            return actionBy(evt);
        }
 /// <summary>
 /// Updating status for Event type
 /// </summary>
 /// <param name="tevent">Event type</param>
 /// <param name="index">Position in list</param>
 /// <param name="tstatus">new status</param>
 public void update(SolutionEventType tevent, int index, StatusType tstatus)
 {
     try {
         states[tevent][index] = tstatus;
     }
     catch(Exception ex) {
         Log.Debug("Updating status: '{0}'", ex.Message);
     }
 }
 /// <summary>
 /// Flushing of all execution statuses by Event type
 /// </summary>
 /// <param name="tevent"></param>
 public void flush(SolutionEventType tevent)
 {
     states[tevent] = new SynchronizedCollection<StatusType>();
 }
Beispiel #44
0
 /// <param name="type"></param>
 public SBEWrap(SolutionEventType type)
 {
     this.type = type;
     update();
 }
        /// <param name="sIndex">Binding index with the Execution status</param>
        protected ISolutionEvent getEventByName(SolutionEventType type, string name, out int sIndex)
        {
            sIndex = -1;
            if(String.IsNullOrEmpty(name)) {
                throw new NotFoundException("getEventByName: name is null or empty");
            }
            ISolutionEvent[] evt = getEvent(type);

            foreach(ISolutionEvent item in evt) {
                ++sIndex;
                if(item.Name == name) {
                    return item;
                }
            }
            throw new NotFoundException("getEvent: not found name - '{0}' with type - '{1}'", name, type);
        }
 /// <param name="sIndex">Binding index with the Execution status</param>
 protected ISolutionEvent getEventByIndex(SolutionEventType type, string index, out int sIndex)
 {
     sIndex = -1;
     ISolutionEvent[] evt = getEvent(type);
     try {
         sIndex = Int32.Parse(index) - 1; // >= 1
         return evt[sIndex];
     }
     catch(Exception) {
         throw new NotFoundException("getEvent: incorrect index - '{0}'({1}) with type - '{2}'", index, evt.Length, type);
     }
 }
Beispiel #47
0
 private int _ignoredAction(SolutionEventType type)
 {
     Log.Trace("[{0}] Ignored action. It's already started in other processes of VS.", type);
     return VSConstants.S_OK;
 }
Beispiel #48
0
 // --------------------------------------------------------------------------------------------
 /// <summary>
 /// Creates event argument for the specified event type.
 /// </summary>
 /// <param name="eventType">Type of solution event</param>
 // --------------------------------------------------------------------------------------------
 public ChangeProjectParentEventArgs(SolutionEventType eventType)
     : base(eventType)
 {
 }
 /// <summary>
 /// Getting the Execution status by Event type and position in list
 /// </summary>
 /// <param name="tevent">Event type</param>
 /// <param name="index">Position in list</param>
 /// <returns>Executed status</returns>
 public StatusType get(SolutionEventType tevent, int index)
 {
     Debug.Assert(states != null);
     try {
         return states[tevent][index];
     }
     catch(Exception) {
         return StatusType.NotFound;
     }
 }
Beispiel #50
0
 public DTEOperation(IEnvironment env, SolutionEventType type)
 {
     this.env    = env;
     this.type   = type;
     initQueue(type);
 }
Beispiel #51
0
 // --------------------------------------------------------------------------------------------
 /// <summary>
 /// Creates event argument for the specified event type.
 /// </summary>
 /// <param name="eventType">Type of solution event</param>
 // --------------------------------------------------------------------------------------------
 public CloseSolutionEventArgs(SolutionEventType eventType)
     : base(eventType)
 {
 }
Beispiel #52
0
 public void initQueue(SolutionEventType type)
 {
     if(queues.ContainsKey(type)) {
         return;
     }
     queues[type] = new TQueue();
 }
 /// <summary>
 /// Changing the Enabled staus for all event-items
 /// </summary>
 /// <param name="type"></param>
 /// <param name="status"></param>
 public void enabled(SolutionEventType type, bool status)
 {
     ISolutionEvent[] evt = getEvent(type);
     foreach(ISolutionEvent item in evt) {
         item.Enabled = status;
     }
 }
Beispiel #54
0
 // --------------------------------------------------------------------------------------------
 /// <summary>
 /// Creates event argument for the specified event type.
 /// </summary>
 /// <param name="eventType">Type of solution event</param>
 // --------------------------------------------------------------------------------------------
 public LoadProjectEventArgs(SolutionEventType eventType)
     : base(eventType)
 {
 }
        public void restore(SolutionEventType type)
        {
            if(status.ContainsKey(type) && status[type] != null)
            {
                ISolutionEvent[] evt = getEvent(type);
                for(int i = 0; i < evt.Length; ++i) {
                    evt[i].Enabled = status[type][i];
                }
            }

            if(isDisabledAll(type)) {
                enabled(type, true);
            }
        }
Beispiel #56
0
 // --------------------------------------------------------------------------------------------
 /// <summary>
 /// Creates event argument for the specified event type.
 /// </summary>
 /// <param name="eventType">Type of solution event</param>
 // --------------------------------------------------------------------------------------------
 public OpenSolutionEventArgs(SolutionEventType eventType)
     : base(eventType)
 {
 }
 protected virtual ISolutionEvent[] getEvent(SolutionEventType type)
 {
     return Settings.Cfg.getEvent(type);
 }
Beispiel #58
0
 // --------------------------------------------------------------------------------------------
 /// <summary>
 /// Creates event argument for the specified event type.
 /// </summary>
 /// <param name="eventType">Type of solution event</param>
 // --------------------------------------------------------------------------------------------
 public SolutionEventArgs(SolutionEventType eventType)
 {
     EventType = eventType;
 }
        /// <summary>
        /// Provides captions by event type and selection mode
        /// </summary>
        /// <param name="type"></param>
        /// <param name="selected"></param>
        /// <exception cref="*"></exception>
        public string caption(SolutionEventType type, bool selected)
        {
            ISolutionEvent[] evt = getEvent(type);
            int enabled = (evt == null)? 0 : evt.Where(i => i.Enabled).Count();
            if(selected) {
                return String.Format("({0} /{1})", enabled, evt.Length);
            }

            if(enabled < 1) {
                return caption(type);
            }
            return String.Format("{0} ({1})", caption(type), enabled);
        }
Beispiel #60
0
 // --------------------------------------------------------------------------------------------
 /// <summary>
 /// Creates event argument for the specified event type.
 /// </summary>
 /// <param name="eventType">Type of solution event</param>
 // --------------------------------------------------------------------------------------------
 public SolutionNodeEventArgs(SolutionEventType eventType)
     : base(eventType)
 {
 }