public Row(DeviceDescription device)
        {
            InitializeComponent();
            root.DataContext = this;

            Device = device;
        }
        public ListItem(DeviceDescription device)
        {
            InitializeComponent();
            root.DataContext = this;
            Device = device;

            if (!string.IsNullOrEmpty(device.Description.ImageUrl)) LoadDeviceImage(device.Description.ImageUrl);
        }
        public DeviceItem(Footprint parent, DeviceDescription device)
        {
            InitializeComponent();
            root.DataContext = this;
            Parent = parent;
            Device = device;

            StatusBrush = Brush_Functions.GetSolidBrushFromResource(this, "Disabled");
        }
        public DeviceItem(ShopStatus parent, DeviceDescription device)
        {
            InitializeComponent();
            root.DataContext = this;
            Parent = parent;
            Device = device;

            StatusBrush = Brush_Functions.GetSolidBrushFromResource(this, "Disabled");

            if (!string.IsNullOrEmpty(device.Description.ImageUrl)) LoadDeviceImage(device.Description.ImageUrl);
        }
        private Controls.ListItem AddListItem(DeviceDescription device)
        {
            var listItem = new Controls.ListItem(device);
            ListItems.Add(listItem);

            return listItem;
        }
        private static string GetPageHeading(DeviceDescription device)
        {
            if (device != null && device.Description != null)
            {
                string heading = "Device Details";

                if (!string.IsNullOrEmpty(device.Description.Description)) heading += " : " + device.Description.Description;
                if (!string.IsNullOrEmpty(device.Description.DeviceId)) heading += " : " + device.Description.DeviceId;
                if (!string.IsNullOrEmpty(device.Description.Manufacturer)) heading += " : " + device.Description.Manufacturer;
                if (!string.IsNullOrEmpty(device.Description.Model)) heading += " : " + device.Description.Model;
                if (!string.IsNullOrEmpty(device.Description.Serial)) heading += " : " + device.Description.Serial;

                return heading;
            }

            return null;
        }
        public Column(DeviceDescription device, UserConfiguration userConfig)
        {
            InitializeComponent();
            root.DataContext = this;

            UserConfiguration = userConfig;

            Device = device;
        }
        private void RemoveRow(DeviceDescription device)
        {
            int index = Rows.ToList().FindIndex(x => x.Device.UniqueId == device.UniqueId);
            if (index >= 0)
            {
                // Remove Event Handlers
                var row = Rows[index];
                row.Clicked -= Row_Clicked;

                Rows.RemoveAt(index);
            }
        }
 private void UpdateRow(DeviceDescription device)
 {
     int index = Rows.ToList().FindIndex(x => x.Device.UniqueId == device.UniqueId);
     if (index >= 0)
     {
         var column = Rows[index];
         column.Device = device;
         Rows.Sort();
     }
 }
        public Page(DeviceDescription device, Data.DeviceInfo deviceInfo, UserConfiguration userConfig)
        {
            InitializeComponent();
            root.DataContext = this;

            UserConfiguration = userConfig;

            Device = device;

            // Active Hour Segments
            ActiveHourDatas = new List<HourData>();
            for (var x = 0; x < 24; x++) ActiveHourDatas.Add(new HourData(x, x + 1));

            // Idle Hour Segments
            IdleHourDatas = new List<HourData>();
            for (var x = 0; x < 24; x++) IdleHourDatas.Add(new HourData(x, x + 1));

            // Alert Hour Segments
            AlertHourDatas = new List<HourData>();
            for (var x = 0; x < 24; x++) AlertHourDatas.Add(new HourData(x, x + 1));

            // Oee Hour Segments
            OeeHourDatas = new List<HourData>();
            for (var x = 0; x < 24; x++) OeeHourDatas.Add(new HourData(x, x + 1));

            // Availability Hour Segments
            AvailabilityHourDatas = new List<HourData>();
            for (var x = 0; x < 24; x++) AvailabilityHourDatas.Add(new HourData(x, x + 1));

            // Performance Hour Segments
            PerformanceHourDatas = new List<HourData>();
            for (var x = 0; x < 24; x++) PerformanceHourDatas.Add(new HourData(x, x + 1));

            // Quality Hour Segments
            QualityHourDatas = new List<HourData>();
            for (var x = 0; x < 24; x++) QualityHourDatas.Add(new HourData(x, x + 1));

            // Parts Count Hour Segments
            PartCountHourDatas = new List<HourData>();
            for (var x = 0; x < 24; x++) PartCountHourDatas.Add(new HourData(x, x + 1));

            // Initialize Device Status Pie Chart
            DeviceStatusPieChartData.Clear();
            DeviceStatusPieChartData.Add(new PieChartData("Active"));
            DeviceStatusPieChartData.Add(new PieChartData("Idle"));
            DeviceStatusPieChartData.Add(new PieChartData("Alert"));

            if (deviceInfo != null)
            {
                UpdateDeviceInfo(deviceInfo.Status);
                UpdateDeviceInfo(deviceInfo.Controller);
                UpdateDeviceInfo(deviceInfo.Oee);
                UpdateDeviceInfo(deviceInfo.Timers);
                UpdateDeviceInfo(deviceInfo.Hours);
            }

            Loading = false;
        }
 private void UpdateListItem(DeviceDescription device)
 {
     int i = ListItems.ToList().FindIndex(x => x.Device.UniqueId == device.UniqueId);
     if (i >= 0)
     {
         if (device.Enabled) ListItems[i].Device = device;
         else RemoveListItem(ListItems[i]);
     }
 }
 private void SendDeviceUpdatedMessage(DeviceDescription device)
 {
     // Send message to plugins that Device has been updated
     var data = new EventData(this);
     data.Id = "DEVICE_UPDATED";
     data.Data01 = device;
     SendEventData(data);
 }
 /// <summary>
 /// Adds a device to the Device List
 /// </summary>
 /// <param name="config">The Device to add</param>
 public void AddDevice(DeviceDescription device)
 {
     Devices.Add(device);
     SendDeviceAddedMessage(device);
 }
        public Item(DeviceDescription device, UserConfiguration userConfig)
        {
            InitializeComponent();
            root.DataContext = this;

            UserConfiguration = userConfig;
            Device = device;
            UniqueId = device.UniqueId;
        }
        private void RemoveItem(DeviceDescription device)
        {
            int index = Items.ToList().FindIndex(x => x.Device.UniqueId == device.UniqueId);
            if (index >= 0)
            {
                // Remove Event Handlers
                var column = Items[index];
                column.Clicked -= Item_Clicked;

                Items.RemoveAt(index);
            }
        }
 private void AddItem(DeviceDescription device)
 {
     if (device != null && device.Enabled && !Items.ToList().Exists(o => o.Device.UniqueId == device.UniqueId))
     {
         var item = new Controls.Item(device, userConfiguration);
         item.ComparisonType = comparisonType;
         item.Clicked += Item_Clicked;
         Items.Add(item);
         Items.Sort();
     }
 }
Beispiel #17
0
        public void DeviceManager_EditDevice_Open(DeviceDescription device)
        {
            string title = "Edit Device";
            if (device.Description != null)
            {
                if (device.Description.Description != null) title += " - " + device.Description.Description;
                if (device.Description.DeviceId != null) title += " (" + device.Description.DeviceId + ")";
            }

            string tag = device.UniqueId;

            var tab = FindTab(title, tag);
            if (tab == null)
            {
                var page = new EditPage(CurrentUser, device.UniqueId);

                ImageSource img = null;
                if (page.Image != null) img = new BitmapImage(page.Image);

                page.DeviceListSelected += DeviceManager_EditDevice_DeviceListSelected;

                AddTab(page, title, img, tag);
            }
            else
            {
                SelectTab(tab);
            }
        }
        private Controls.DeviceItem AddDeviceItem(DeviceDescription device)
        {
            var deviceItem = new Controls.DeviceItem(this, device);
            deviceItem.Moved += DeviceItem_Updated;
            deviceItem.Resized += DeviceItem_Updated;
            deviceItem.ViewDetails += DeviceItem_ViewDetails;
            deviceItem.EditDevice += DeviceItem_EditDevice;
            deviceItem.CloseClicked += DeviceItem_CloseClicked;

            // Add to Canvas
            shopCanvas.Children.Add(deviceItem);

            // Add to DeviceItems collection (to update data)
            DeviceItems.Add(deviceItem);

            return deviceItem;
        }
Beispiel #19
0
 private void DeviceManager_DeviceList_DeviceEditSelected(DeviceDescription device)
 {
     DeviceManager_EditDevice_Open(device);
 }
        private void LoadDeviceItem(DeviceDescription device)
        {
            var location = LoadDeviceItemLocation(device.UniqueId);
            if (location != null)
            {
                var deviceItem = AddDeviceItem(device);

                Canvas.SetLeft(deviceItem, location.X);
                Canvas.SetTop(deviceItem, location.Y);

                deviceItem.Height = location.Height;
                deviceItem.Width = location.Width;
            }
            else
            {
                AddListItem(device);
            }
        }
 private void AddRow(DeviceDescription device)
 {
     if (device != null && device.Enabled && !Rows.ToList().Exists(o => o.Device.UniqueId == device.UniqueId))
     {
         var row = new Controls.Row(device);
         row.ComparisonType = comparisonType;
         row.Clicked += Row_Clicked;
         Rows.Add(row);
         Rows.Sort();
     }
 }
 private void AddColumn(DeviceDescription device)
 {
     if (device != null && device.Enabled && !Columns.ToList().Exists(o => o.Device.UniqueId == device.UniqueId))
     {
         var column = new Controls.Column(device, userConfiguration);
         column.ComparisonType = comparisonType;
         column.Clicked += ColumnClicked;
         Columns.Add(column);
         Columns.Sort();
     }
 }