Ejemplo n.º 1
0
        public ViewResolvingPlotModel InitializeDefault(IEnumerable <MultiRoomInfo> collection, int code)
        {
            ViewResolvingPlotModel result      = ViewResolvingPlotModel.CreateDefault();
            var humidityLineSerie              = result.GetLast();
            var temperatureLineSerie           = result.GetFirst();
            List <DataPoint> humidityPoints    = new List <DataPoint>();
            List <DataPoint> temperaturePoints = new List <DataPoint>();

            switch (code)
            {
            case 1:
                humidityPoints    = collection.Select(x => new DataPoint(DateTimeAxis.ToDouble(x.Date), x.Humidity)).ToList();
                temperaturePoints = collection.Select(x => new DataPoint(DateTimeAxis.ToDouble(x.Date), x.Temperature)).ToList();
                break;

            case 2:
                humidityPoints    = collection.Select(x => new DataPoint(DateTimeAxis.ToDouble(x.Date), x.HumidityMiddle)).ToList();
                temperaturePoints = collection.Select(x => new DataPoint(DateTimeAxis.ToDouble(x.Date), x.TemperatureMiddle)).ToList();
                break;

            case 3:
                humidityPoints    = collection.Select(x => new DataPoint(DateTimeAxis.ToDouble(x.Date), x.HumidityProcess)).ToList();
                temperaturePoints = collection.Select(x => new DataPoint(DateTimeAxis.ToDouble(x.Date), x.TemperatureNord)).ToList();
                break;

            case 4:
                humidityPoints    = collection.Select(x => new DataPoint(DateTimeAxis.ToDouble(x.Date), x.HumidityProcess)).ToList();
                temperaturePoints = collection.Select(x => new DataPoint(DateTimeAxis.ToDouble(x.Date), x.TemperatureProcess)).ToList();
                break;

            default:
                break;
            }


            result.FillCollection(temperatureLineSerie, temperaturePoints);
            result.FillCollection(humidityLineSerie, humidityPoints);

            result.SetLastNHours(6);
            result.AddAnnotationEveryDay();

            //		GraphInfo.GraphLineModelForDefault.InvalidatePlot(true);

            return(result);
        }
Ejemplo n.º 2
0
        public override void OnDialogOpened(IDialogParameters parameters)
        {
            if (parameters != null)
            {
                GraphInfo            = parameters.GetValue <RoomLineGraphInfo>("model");
                TemperatureGraphInfo = RoomLineGraphInfo.CreateDefault();
                TemperatureGraphInfo.GraphLineModel = ViewResolvingPlotModel.CreateDefault(18, 60);
                HumidityGraphInfo = RoomLineGraphInfo.CreateDefault();
                HumidityGraphInfo.GraphLineModel = ViewResolvingPlotModel.CreateDefault(45, 75);

                TemperatureGraphInfo.GraphLineModel.GetLast().IsVisible = false;
                HumidityGraphInfo.GraphLineModel.GetFirst().IsVisible   = false;

                GraphInfo.AddToCollectionEvent += Current_AddToCollectionEvent;
                Title = $"{GraphInfo?.ActiveDevice?.Nick} {GraphInfo?.ActiveDevice?.IPAddress}";
                var points = _roomRepository.FilterRooms(GraphInfo.ActiveDevice.Id).GetAwaiter().GetResult();
                FillTemperatureGraph(points);
                FillHumidityGraph(points);
                InitializeAnnotations();
                SetSettings();

                if (parameters.TryGetValue("dataType", out int value))
                {
                    if (value == 2)
                    {
                        TemperatureText += " Мид";
                    }
                    if (value == 3)
                    {
                        TemperatureText += " Норд";
                    }
                    if (value == 4)
                    {
                        TemperatureText += " Процесс";
                    }
                }
            }
        }