Exemple #1
0
 private void OnOptionOnCisTrue(ChannelPieChartOptions o, ChannelPieChartOptions[] collection)
 {
     foreach (ChannelPieChartOptions optionse in collection)
     {
         if (optionse != o)
         {
             optionse.C = false;
         }
     }
 }
Exemple #2
0
 protected virtual void OnAisTrue(ChannelPieChartOptions obj)
 {
     this.AisTrue?.Invoke(obj);
 }
Exemple #3
0
        public PieChartOptions(AnalogChannel[] channels)
        {
            this.Lenght            = channels[0].Length;
            this._allChartOptions  = channels.Select(o => new ChannelPieChartOptions(o)).ToArray();
            this._pieIChartOptions = this._allChartOptions.Where(o => o.Channel.Measure == "A").ToArray();
            this.StartTime         = 20;
            this.EndTime           = this.Lenght - 1;

            for (int i = 0; i < this.PieIChartOptions.Length; i++)
            {
                ChannelPieChartOptions option = this.PieIChartOptions[i];

                switch (i)
                {
                case 0:
                {
                    option.A = true;
                    break;
                }

                case 1:
                {
                    option.B = true;
                    break;
                }

                case 2:
                {
                    option.C = true;
                    break;
                }
                }


                option.AisTrue += o => this.OnOptionOnAisTrue(o, this.PieIChartOptions);
                option.BisTrue += o => this.OnOptionOnBisTrue(o, this.PieIChartOptions);
                option.CisTrue += o => this.OnOptionOnCisTrue(o, this.PieIChartOptions);
                // option.NisTrue += o => OnOptionOnNisTrue(o, PieIChartOptions);
                option.PropertyChanged += this.option_PropertyChanged;
            }


            this._pieUChartOptions = this._allChartOptions.Where(o => o.Channel.Measure == "V").ToArray();
            for (int i = 0; i < this.PieUChartOptions.Length; i++)
            {
                ChannelPieChartOptions option = this.PieUChartOptions[i];
                switch (i)
                {
                case 0:
                {
                    option.A = true;
                    break;
                }

                case 1:
                {
                    option.B = true;
                    break;
                }

                case 2:
                {
                    option.C = true;
                    break;
                }

                    /* case 3:
                     *   {
                     *       option.N = true;
                     *       break;
                     *   }*/
                }
                option.AisTrue         += o => this.OnOptionOnAisTrue(o, this.PieUChartOptions);
                option.BisTrue         += o => this.OnOptionOnBisTrue(o, this.PieUChartOptions);
                option.CisTrue         += o => this.OnOptionOnCisTrue(o, this.PieUChartOptions);
                option.PropertyChanged += this.option_PropertyChanged;
            }
        }
Exemple #4
0
        public void Load(string fileName)
        {
            XDocument doc = XDocument.Load(fileName);

            foreach (XElement element in doc.Root.Elements())
            {
                if (element.Name == "Z1")
                {
                    this.Z1 = new ZnOptions();
                    this.Z1.FromXml(element);
                }
                if (element.Name == "Z2")
                {
                    this.Z2 = new ZnOptions();
                    this.Z2.FromXml(element);
                }
                if (element.Name == "Z3")
                {
                    this.Z3 = new ZnOptions();
                    this.Z3.FromXml(element);
                }
                if (element.Name == "Z4")
                {
                    this.Z4 = new ZnOptions();
                    this.Z4.FromXml(element);
                }
                if (element.Name == "Z5")
                {
                    this.Z5 = new ZnOptions();
                    this.Z5.FromXml(element);
                }
                if (element.Name == "Characteristics")
                {
                    this._characteristics = this.CharacteristicFromXml(element);
                }
                if (element.Name == "Visibly")
                {
                    this.VisiblyOptions.FromXml(element);
                }
                if (element.Name == "Channels")
                {
                    IEnumerable <XAttribute> attributes = element.Attributes();
                    IEnumerable <string>     values     =
                        attributes.Select(o => o.Value).Where(o => !string.IsNullOrWhiteSpace(o));
                    if (this._allChartOptions != null)
                    {
                        IEnumerable <string> otherChannels = values.Except(this._allChartOptions.Select(o => o.Name));
                        if (otherChannels.Count() != 0)
                        {
                            MessageBox.Show("Неверный файл");
                            return;
                        }
                    }

                    string value = attributes.First(a => a.Name == "Ia").Value;
                    ChannelPieChartOptions option = this._pieIChartOptions.FirstOrDefault(o => o.Name == value);
                    if (option == null)
                    {
                        this.OnOptionOnAisTrue(null, this._pieIChartOptions);
                    }
                    else
                    {
                        option.A = true;
                    }

                    value  = attributes.First(a => a.Name == "Ib").Value;
                    option = this._pieIChartOptions.FirstOrDefault(o => o.Name == value);
                    if (option == null)
                    {
                        this.OnOptionOnBisTrue(null, this._pieIChartOptions);
                    }
                    else
                    {
                        option.B = true;
                    }


                    value  = attributes.First(a => a.Name == "Ic").Value;
                    option = this._pieIChartOptions.FirstOrDefault(o => o.Name == value);
                    if (option == null)
                    {
                        this.OnOptionOnCisTrue(null, this._pieIChartOptions);
                    }
                    else
                    {
                        option.C = true;
                    }

                    value  = attributes.First(a => a.Name == "Ua").Value;
                    option = this._pieUChartOptions.FirstOrDefault(o => o.Name == value);
                    if (option == null)
                    {
                        this.OnOptionOnAisTrue(null, this._pieUChartOptions);
                    }
                    else
                    {
                        option.A = true;
                    }


                    value  = attributes.First(a => a.Name == "Ub").Value;
                    option = this._pieUChartOptions.FirstOrDefault(o => o.Name == value);
                    if (option == null)
                    {
                        this.OnOptionOnBisTrue(null, this._pieUChartOptions);
                    }
                    else
                    {
                        option.B = true;
                    }


                    value  = attributes.First(a => a.Name == "Uc").Value;
                    option = this._pieUChartOptions.FirstOrDefault(o => o.Name == value);
                    if (option == null)
                    {
                        this.OnOptionOnCisTrue(null, this._pieUChartOptions);
                    }
                    else
                    {
                        option.C = true;
                    }

                    this.ChannelAccept();
                }
            }
        }