public Compresor() { this.InitializeComponent(); handler = this; readBufferLength = 64; received = new Byte[readBufferLength]; compressor_intern_temperatures = new UInt16[3]; sizeofStruct = Marshal.SizeOf(typeof(SingleTaskMessage)); byte_message = new Byte[Marshal.SizeOf(typeof(CompressorCompleteMessage))]; listOfToggles = new ObservableCollection <ToggleSwitch>(); listOfToggles.Add(EnableToogle1); listOfToggles.Add(EnableToogle2); listOfToggles.Add(EnableToogle3); listOfBorders = new ObservableCollection <Border>(); listOfBorders.Add(StatusBorder1); listOfBorders.Add(StatusBorder2); listOfBorders.Add(StatusBorder3); listOfTextBlocks = new ObservableCollection <TextBlock>(); listOfTextBlocks.Add(StatusText1); listOfTextBlocks.Add(StatusText2); listOfTextBlocks.Add(StatusText3); listOfTextBlocks.Add(StatusLabel4); listOfTextBlocks.Add(ErrorFlagsLabel); listOfTextBlocks.Add(MotorTempText); listOfTextBlocks.Add(CoolantTempText); listOfTextBlocks.Add(PressureHighText); listOfTextBlocks.Add(PressureLowText); listOfTextBlocks.Add(IQCurrentText); listOfTextBlocks.Add(IDCurrentText); listOfTextBlocks.Add(MotorText); listOfTextBlocks.Add(ControllerText); listOfTextBlocks.Add(CPUText); listOfEllipses = new ObservableCollection <Ellipse>(); listOfEllipses.Add(FaultSignal1); listOfEllipses.Add(FaultSignal2); listOfEllipses.Add(FaultSignal3); listOfEllipses.Add(ExternFaultSignal); listOfEllipses.Add(ErrorFlagsFaultSignal); listOfEllipses.Add(PressureHighSignal); listOfEllipses.Add(PressureLowSignal); listOfSliders = new ObservableCollection <Slider>(); listOfSliders.Add(MotorTemperature); listOfSliders.Add(Coolant); listOfSliders.Add(MotorSlider); listOfSliders.Add(ControllerSlider); listOfSliders.Add(CPUSlider); listOfDarkAnimations = new ObservableCollection <AnimationSet>(); listOfLightAnimations = new ObservableCollection <AnimationSet>(); for (int i = 0; i < (NUMBER_OF_FAULTS + NUMBER_OF_SWITCHES); i++) { listOfDarkAnimations.Add(listOfEllipses[i].Fade(value: 0.15f, duration: 1000, delay: 25, easingType: EasingType.Sine)); listOfLightAnimations.Add(listOfEllipses[i].Fade(value: 0.95f, duration: 1000, delay: 25, easingType: EasingType.Sine)); } listOfDarkAnimations[listOfDarkAnimations.Count - 1].Completed += Fault_DarkAnimation_Completed; listOfLightAnimations[listOfLightAnimations.Count - 1].Completed += FaultLigthAnimation_Completed; foreach (AnimationSet an in listOfDarkAnimations) { an.StartAsync(); } foreach (ToggleSwitch ts in listOfToggles) { ts.ManipulationStarted += EnableToggle_ManipulationStarted; ts.ManipulationCompleted += EnableToggle_ManipulationCompleted; } Speed.ManipulationStarted += EnableToggle_ManipulationStarted; Speed.ManipulationCompleted += EnableToggle_ManipulationCompleted; Fault_Dark = Speed.Fade(value: 0.15f, duration: 1000, delay: 25, easingType: EasingType.Sine); Fault_Light = Speed.Fade(value: 0.95f, duration: 1000, delay: 25, easingType: EasingType.Sine); }