private void SetWatchStatusPanel(SeriesState s)
        {
            switch (s)
            {
            case SeriesState.Incomplete:
                WatchStatusPanel.Background = INCOMPLETE_COLOR;
                WatchStatusText.Text        = INCOMPLETE_TEXT;
                break;

            case SeriesState.Watching:
                WatchStatusPanel.Background = WATCHING_COLOR;
                WatchStatusText.Text        = WATCHING_TEXT;
                break;

            case SeriesState.Complete:
                WatchStatusPanel.Background = COMPLETE_COLOR;
                WatchStatusText.Text        = COMPLETE_TEXT;
                break;

            case SeriesState.Dropped:
                WatchStatusPanel.Background = DROPPED_COLOR;
                WatchStatusText.Text        = DROPPED_TEXT;
                break;
            }
        }
Пример #2
0
        public MonitorFrame(byte[] buf)
        {
            if (buf.Length < frame_len)
            {
                return;
            }
            frame_head_tag = BitConverter.ToUInt16(buf, 0);
            if (frame_head_tag != 0xAA50)
            {
                return;
            }

            frame_sn     = BitConverter.ToUInt16(buf, 2);
            time_stamp   = BitConverter.ToUInt32(buf, 4);
            data_type    = (MonitorDataType)BitConverter.ToUInt16(buf, 8);
            series_state = (SeriesState)buf[10];
            cpu_state    = (CpuState)buf[11];
            data_length  = BitConverter.ToUInt16(buf, 12);

            crc = BitConverter.ToUInt16(buf, 14);

            UInt16 new_crc = Crc16.GetCrc(buf, 14);

            if (new_crc != crc)
            {
                return;
            }
            is_ok = true;
            return;
        }
Пример #3
0
 public SeriesDetails(Series s, string title, SeriesState watchState, StorageFile posterFile, StorageFile panelFile, List <Episode> episodes)
 {
     this.s                = s;
     this.seriesTitle      = title;
     this.seriesWatchState = watchState;
     this.setPoster(posterFile);
     this.setPanel(panelFile);
     this.seriesEpisodes = episodes;
 }
Пример #4
0
        private async Task <EpisodeData> ReadData(StorageFile d)
        {
            EpisodeData episodeData = null;
            string      data        = await FileIO.ReadTextAsync(d);

            int         watched = Convert.ToInt32(Char.GetNumericValue(data[0]));
            SeriesState state   = (SeriesState)Convert.ToInt32(Char.GetNumericValue(data[2]));

            episodeData = new EpisodeData(watched, state, d);
            return(episodeData);
        }
Пример #5
0
 internal static double Formula5(RowValues rowValues, SeriesState state)
 {
     if (iCalculator != null)
     {
         try {
             return(iCalculator.Formula5(rowValues, state));
         }
         catch (Exception ex) {
             AppManager.MainForm.SetStatusLabel("P10: " + Resources.CalculatorProxyRuntimeError); //@Language Resource
             AppExtension.PrintStackTrace(ex);
         }
     }
     return(0.0);
 }
Пример #6
0
        public List <Series> GetSeriesList(List <Series> list, SeriesState targetState)
        {
            List <Series> result = new List <Series>();

            foreach (Series s in list)
            {
                SeriesState state = s.watchState;
                if (state == targetState)
                {
                    result.Add(s);
                }
            }
            return(result);
        }
Пример #7
0
        public List <SeriesQueue> GetSeriesQueue(List <Series> list, SeriesState targetState)
        {
            List <SeriesQueue> result = new List <SeriesQueue>();

            foreach (Series s in list)
            {
                SeriesState state = s.watchState;
                if (state == targetState)
                {
                    SeriesQueue sq = s.getSeriesWatching();
                    result.Add(sq);
                }
            }
            return(result);
        }
Пример #8
0
 private void FillSeriesWithNewData(CheckBoxTag tag, DateTime from, DateTime to)
 {
     if (tag != null)
     {
         Chart chartMain = AppManager.MainForm.ChartControl.ChartMain;
         int   fromIndex = GetSolvisListIndex(from);
         int   toIndex   = GetSolvisListIndex(to);
         chartMain.BeginInit();
         DataPointCollection points = tag.Series.Points;
         points.ClearFast(); //MsChartExtension
         if (fromIndex < 0 || fromIndex >= toIndex)
         {
             return;
         }
         points.SuspendUpdates();
         for (int i = fromIndex; i <= toIndex; i++)
         {
             RowValues values = SolvisList[i];
             if (tag.Ident == GroupIdent.Sensor)
             {
                 points.AddXY(values.DateAndTime, values.GetSensorValue(tag.Index));
             }
             else if (tag.Ident == GroupIdent.Actor)
             {
                 points.AddXY(values.DateAndTime, values.GetActorValue(tag.Index));
             }
             else     //GroupIdent.Option
             {
                 SeriesState state = SeriesState.Inner;
                 if (i == fromIndex)
                 {
                     state = SeriesState.First;
                 }
                 else if (i == toIndex)
                 {
                     state = SeriesState.Last;
                 }
                 SetOptionsPoints(tag.Index, values, points, state);
             }
         }
         points.ResumeUpdates();
         if (!chartMain.Series.Contains(tag.Series))
         {
             chartMain.Series.Add(tag.Series);
         }
         chartMain.EndInit();
     }
 }
Пример #9
0
        public void setWatchState(SeriesState s)
        {
            this.watchState = s;
            switch (s)
            {
            case SeriesState.Incomplete:
                this.watchStateImage = new BitmapImage(new Uri("ms-appx:///Assets/incomplete_banner.png"));
                break;

            case SeriesState.Watching:
                this.watchStateImage = new BitmapImage(new Uri("ms-appx:///Assets/watching_banner.png"));
                break;

            case SeriesState.Complete:
                this.watchStateImage = new BitmapImage(new Uri("ms-appx:///Assets/completed_banner.png"));
                break;

            case SeriesState.Dropped:
                this.watchStateImage = new BitmapImage(new Uri("ms-appx:///Assets/dropped_banner.png"));
                break;
            }
        }
Пример #10
0
        public void AddSeries(Series s)
        {
            SeriesState state = s.watchState;

            switch (state)
            {
            case SeriesState.Incomplete:
                this.incompleteList.Add(s);
                break;

            case SeriesState.Watching:
                this.watchList.Add(s);
                break;

            case SeriesState.Complete:
                this.completedList.Add(s);
                break;

            case SeriesState.Dropped:
                this.droppedList.Add(s);
                break;
            }
        }
Пример #11
0
        private static void SetOptionsPoints(int index, RowValues values, DataPointCollection points, SeriesState state)
        {
            switch (index)
            {
            case 0:
                points.AddXY(values.DateAndTime, values.FormulaBurner);
                break;

            case 1:
                points.AddXY(values.DateAndTime, values.FormulaSolarKW);
                break;

            case 2:
                points.AddXY(values.DateAndTime, values.FormulaSunPosition);
                break;

            case 3:
                points.AddXY(values.DateAndTime, values.FormulaIst_Soll1);
                break;

            case 4:
                points.AddXY(values.DateAndTime, values.FormulaIst_Soll2);
                break;

            case 5:
                points.AddXY(values.DateAndTime, CalculatorProxy.Formula1(values, state));
                break;

            case 6:
                points.AddXY(values.DateAndTime, CalculatorProxy.Formula2(values, state));
                break;

            case 7:
                points.AddXY(values.DateAndTime, CalculatorProxy.Formula3(values, state));
                break;

            case 8:
                points.AddXY(values.DateAndTime, CalculatorProxy.Formula4(values, state));
                break;

            case 9:
                points.AddXY(values.DateAndTime, CalculatorProxy.Formula5(values, state));
                break;

            default:
                break;
            }
        }
Пример #12
0
        private async Task <EpisodeData> WriteData(StorageFile f, int watched, SeriesState state)
        {
            await FileIO.WriteTextAsync(f, watched + "\n" + ((int)state).ToString());

            return(new EpisodeData(watched, state, f));
        }
 private void UpdateSeriesData(SeriesState state)
 {
     this.selectedSeries.setWatchState(state);
     this.selectedSeries.UpdateSeriesData();
     this.SetWatchStatusPanel(state);
 }
Пример #14
0
        public List <SeriesQueue> GetSeriesQueue(SeriesState targetState)
        {
            List <SeriesQueue> result = this.watchData.GetSeriesQueue(this.series, targetState);

            return(result);
        }
Пример #15
0
        public List <Series> GetSeries(SeriesState targetState)
        {
            List <Series> result = this.watchData.GetSeriesList(this.series, targetState);

            return(result);
        }
Пример #16
0
 public double Formula5(RowValues rowValues, SeriesState state)
 {
     return(0.0);
 }
Пример #17
0
        private void FillAllCheckedSeriesWithNewData(DateTime from, DateTime to)
        {
            Chart chartMain = AppManager.MainForm.ChartControl.ChartMain;
            int   fromIndex = GetSolvisListIndex(from);
            int   toIndex   = GetSolvisListIndex(to);

            chartMain.BeginInit();
            AppManager.MainForm.ChartControl.SetIntervals(new TimeSpan(to.Ticks - from.Ticks));
            MainForm mainForm = AppManager.MainForm;

            for (int seriesIndex = 0; seriesIndex < mainForm.SensorsCheckBoxes.Count; seriesIndex++)
            {
                CheckBox checkBox = mainForm.SensorsCheckBoxes[seriesIndex];
                if (checkBox.Checked)
                {
                    CheckBoxTag tag = checkBox.Tag as CheckBoxTag;
                    if (tag != null)
                    {
                        Series series = tag.Series;
                        DataPointCollection points = series.Points;
                        points.ClearFast(); //MsChartExtension
                        if (fromIndex < 0 || fromIndex >= toIndex)
                        {
                            continue;
                        }
                        points.SuspendUpdates();
                        for (int i = fromIndex; i <= toIndex; i++)
                        {
                            RowValues values = SolvisList[i];
                            points.AddXY(values.DateAndTime, values.GetSensorValue(seriesIndex));
                        }
                        points.ResumeUpdates();
                        if (!chartMain.Series.Contains(series))
                        {
                            chartMain.Series.Add(series);
                        }
                    }
                }
            }
            for (int seriesIndex = 0; seriesIndex < mainForm.ActorsCheckBoxes.Count; seriesIndex++)
            {
                CheckBox checkBox = mainForm.ActorsCheckBoxes[seriesIndex];
                if (checkBox.Checked)
                {
                    CheckBoxTag tag = checkBox.Tag as CheckBoxTag;
                    if (tag != null)
                    {
                        Series series = tag.Series;
                        DataPointCollection points = series.Points;
                        points.ClearFast(); //MsChartExtension
                        if (fromIndex < 0 || fromIndex >= toIndex)
                        {
                            continue;
                        }
                        points.SuspendUpdates();
                        for (int i = fromIndex; i <= toIndex; i++)
                        {
                            RowValues values = SolvisList[i];
                            points.AddXY(values.DateAndTime, values.GetActorValue(seriesIndex));
                        }
                        points.ResumeUpdates();
                        if (!chartMain.Series.Contains(series))
                        {
                            chartMain.Series.Add(series);
                        }
                    }
                }
            }
            for (int seriesIndex = 0; seriesIndex < mainForm.OptionsCheckBoxes.Count; seriesIndex++)
            {
                CheckBox checkBox = mainForm.OptionsCheckBoxes[seriesIndex];
                if (checkBox.Checked)
                {
                    CheckBoxTag tag = checkBox.Tag as CheckBoxTag;
                    if (tag != null)
                    {
                        Series series = tag.Series;
                        DataPointCollection points = series.Points;
                        points.ClearFast(); //MsChartExtension
                        if (fromIndex < 0 || fromIndex >= toIndex)
                        {
                            continue;
                        }
                        points.SuspendUpdates();
                        for (int i = fromIndex; i <= toIndex; i++)
                        {
                            RowValues   values = SolvisList[i];
                            SeriesState state  = SeriesState.Inner;
                            if (i == fromIndex)
                            {
                                state = SeriesState.First;
                            }
                            else if (i == toIndex)
                            {
                                state = SeriesState.Last;
                            }
                            SetOptionsPoints(seriesIndex, values, points, state);
                        }
                        points.ResumeUpdates();
                        if (!chartMain.Series.Contains(series))
                        {
                            chartMain.Series.Add(series);
                        }
                    }
                }
            }
            chartMain.EndInit();
        }
Пример #18
0
 public EpisodeData(int currentEpisode, SeriesState state, StorageFile file)
 {
     this.currentEpisode = currentEpisode;
     this.watchStatus    = (int)state;
     this.file           = file;
 }