Ejemplo n.º 1
0
        public void LoadConfiguration(DataTable dt)
        {
            Loading            = true;
            loading            = true;
            configurationTable = dt;

            List <Event> genEvents = GetGeneratedEvents(dt);

            if (genEvents.Count > 0)
            {
                DisplayEvents = true;
            }
            else
            {
                DisplayEvents = false;
            }

            CreateGeneratedEvents(genEvents);

            GeneratedEvents.Clear();
            foreach (Event e in genEvents)
            {
                Dispatcher.BeginInvoke(new Action(() => { GeneratedEvents.Add(e); }), System.Windows.Threading.DispatcherPriority.Background, new object[] { });
            }

            // Load MTConnect DataItems using Probe Data
            if (!Loaded)
            {
                LoadCollectedItems(probeData);
            }

            loading = false;
            Dispatcher.BeginInvoke(new Action(() => { Loading = false; }), System.Windows.Threading.DispatcherPriority.Background, new object[] { });
        }
Ejemplo n.º 2
0
        void Event_RemoveClicked(Controls.EventButton bt)
        {
            if (bt.ParentEvent != null)
            {
                int index = GeneratedEvents.ToList().FindIndex(x => x == bt.ParentEvent);
                if (index >= 0)
                {
                    Event e = GeneratedEvents[index];

                    GeneratedEvents.Remove(e);

                    index = EventButtons.ToList().FindIndex(x => x.ButtonContent == bt);
                    if (index >= 0)
                    {
                        EventButtons.RemoveAt(index);
                    }
                }
            }

            if (EventButtons.Count > 0)
            {
                DisplayEvents = true;
            }
            else
            {
                DisplayEvents = false;
            }

            ChangeSetting(null, null, null);
        }
Ejemplo n.º 3
0
        private void AddEvent_Clicked(TrakHound_UI.Button bt)
        {
            Event e = new Event();

            e.name = "EVENT";

            e.Default       = new Result();
            e.Default.value = "DEFAULT";

            GeneratedEvents.Add(e);

            AddEvent(e, true);

            DisplayEvents = true;

            ChangeSetting(null, null, null);
        }
Ejemplo n.º 4
0
 public GeneratedEventItem(GeneratedEvents.Page.Event e)
 {
     Id = e.name;
     Name = String_Functions.UppercaseFirst(e.name.Replace('_', ' ').ToLower());
 }
 public CaptureItem(GeneratedEvents.Page.CaptureItem item)
 {
     Id = item.name;
     Name = String_Functions.UppercaseFirst(item.name.Replace('_', ' '));
 }
Ejemplo n.º 6
0
        private static void ProcessGenerated(Snapshot snapshot, GeneratedEvents.Configuration gec, Instance currentInstanceData, ReturnData currentData)
        {
            var e = gec.Events.Find(x => x.Name.ToLower() == snapshot.Link.ToLower());
            if (e != null)
            {
                Return returnValue = e.Process(currentInstanceData);

                if (snapshot.Value != returnValue.Value)
                {
                    if (returnValue != null)
                    {
                        var value = e.Values.Find(x => x.Result.NumVal == returnValue.NumVal);
                        if (value != null)
                        {
                            snapshot.PreviousTimestamp = GetTimestampFromCurrent(value, currentData);
                        }
                    }

                    snapshot.PreviousValue = snapshot.Value;

                    snapshot.Value = returnValue.Value;
                }

                snapshot.Timestamp = returnValue.TimeStamp;
            }
        }