Exemplo n.º 1
0
 public override double DoSomeWork(double work)
 {
     if (work > 0 && remainder != null)
     {
         remainder.Clear();
     }
     return(base.DoSomeWork(work));
 }
Exemplo n.º 2
0
        public void Refresh()
        {
            // For some reason we have to unselect the selected row before we clear the ItemSource
            SelectedItem = null;

            Requirements.Clear();
            Load(null);
        }
Exemplo n.º 3
0
        public void Clean()
        {
            Repeat = 0;

            Requirements.Clear();
            Raise.Clear();
            Expire.Clear();
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Handles setting all the update information for this element (this updates source)
        /// </summary>
        /// <param name="source"></param>
        public override void SetUpdateInformation(ModelElement source)
        {
            base.SetUpdateInformation(source);

            Enum sourceEnum = source as Enum;

            if (sourceEnum != null)
            {
                Requirements.Clear();
                setUpdates(source.Guid);

                foreach (EnumValue value in Values)
                {
                    EnumValue matchingValue = sourceEnum.FindEnumValue(value.Name);
                    value.setUpdates(matchingValue.Guid);
                }
                foreach (Enum subEnum in SubEnums)
                {
                    Enum matchingEnum = sourceEnum.FindSubEnum(subEnum.Name);
                    subEnum.SetUpdateInformation(matchingEnum);
                }
            }
        }
Exemplo n.º 5
0
        private void OnEventChanged(object sender, EventArgs e)
        {
            // TODO: Optimize this.

            var vm = BindingContext as EventViewModel;

            if (vm == null)
            {
                throw new ApplicationException("Unexpected error occured. Please, restart the application.");
            }

            Requirements.Clear();

            foreach (var req in vm.Event.Requirements)
            {
                var ReqView = CreateView();

                Requirements.Add(CreateSubheader("Requirement"));
                Requirements.Add(CreateLine());
                Requirements.Add(CreateWrapper(ReqView, (Color)Resources["SubheadingColor"]));

                foreach (var condition in req.Conditions)
                {
                    var component = RemoteDevice.FindComponent(condition.ID, condition.CType);
                    var desc      = component?.Description ?? string.Empty;
                    var subh      = desc + "[" + condition.ID + ":" + condition.CType.AsProtocolString() + "]";

                    var CondView = CreateView();

                    ReqView.Add(CreateSubheader(subh));
                    ReqView.Add(CreateLine());
                    ReqView.Add(CondView);

                    foreach (var cmp in condition.Comparators)
                    {
                        Label label = null;

                        if (component != null)
                        {
                            var value = component.Value.Clone();
                            value.Write(cmp.Value.ToString());
                            var displayed = value.Display();

                            label = CreateLabel
                                    (
                                new FormattedString
                            {
                                Spans =
                                {
                                    CreateSpan(cmp.Operator() + ' '),
                                    CreateSpan(displayed.Value, displayed.Color)
                                }
                            }
                                    );
                        }
                        else
                        {
                            label = CreateLabel(cmp.ToString());
                        }

                        if (label != null)
                        {
                            CondView.Add(label);
                        }
                    }
                }
            }

            RaiseActions.Clear();
            ExpireActions.Clear();

            foreach (var write in vm.Event.Raise)
            {
                var desc    = RemoteDevice.FindComponent(write.ID, write.CType)?.Description ?? string.Empty;
                var display = write.Value.Display();
                var text    = desc + "[" + write.ID + ":" + write.CType.AsProtocolString() + "] → " + display.Value;
                var label   = CreateLabel(text, display.Color);
                RaiseActions.Add(label);
            }

            foreach (var write in vm.Event.Expire)
            {
                var desc    = RemoteDevice.FindComponent(write.ID, write.CType)?.Description ?? string.Empty;
                var display = write.Value.Display();
                var text    = desc + "[" + write.ID + ":" + write.CType.AsProtocolString() + "] → " + display.Value;
                var label   = CreateLabel(text, display.Color);
                ExpireActions.Add(label);
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Static properties can persist across executions! need to reset to defaults w/ every execution.
 /// </summary>
 public static void Reset()
 {
     Requirements.Clear();
     MaterialDict = new Dictionary <string, Material>(materialDefaults);
 }
Exemplo n.º 7
0
 /// <summary>
 ///     Removes al requirements from this element
 /// </summary>
 public virtual void ClearAllRequirements()
 {
     Requirements.Clear();
 }
Exemplo n.º 8
0
 public override double DoSomeWork(double work)
 {
     if(work > 0)
         remainder?.Clear();
     return base.DoSomeWork(work);
 }