/// <summary> /// The MovingTextOptionsWindow nees a <see cref="RgbLibrary.MovingText"/> object. /// <para> /// <list type="bullet"> /// <listheader> /// <description>The user can change the properties:</description> /// </listheader> /// <item> /// <description> /// Color /// </description> /// </item> /// <item> /// <description> /// Text /// </description> /// </item> /// <item> /// <description> /// FontSize /// </description> /// </item> /// <item> /// <description> /// Position in x-achses /// </description> /// </item> /// <item> /// <description> /// Position in y-achses /// </description> /// <item> /// <description> /// Scroll Mode /// </description> /// </item> /// </item> /// </list> /// </para> /// </summary> /// <param name="movingText"></param> public MovingTextOptionsWindow(MovingText movingText) { InitializeComponent(); this.movingText = movingText; this.SizeToContent = System.Windows.SizeToContent.WidthAndHeight; this.Topmost = true; Binding ColorBinding = new Binding("ColorPalette"); ColorBinding.Source = this.movingText; ColorBinding.Mode = BindingMode.TwoWay; Palettes.SetBinding(ComboBox.TextProperty, ColorBinding); Binding TextBinding = new Binding("Text"); TextBinding.Source = this.movingText; TextBinding.Mode = BindingMode.TwoWay; TextBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; Text.SetBinding(TextBox.TextProperty, TextBinding); Binding FontSizeBinding = new Binding("FontSize"); FontSizeBinding.Source = this.movingText; FontSizeBinding.Mode = BindingMode.TwoWay; FontSize.SetBinding(Slider.ValueProperty, FontSizeBinding); Binding ModeBinding = new Binding("Mode"); ModeBinding.Source = this.movingText; ModeBinding.Mode = BindingMode.TwoWay; Selected_Objects.SetBinding(ComboBox.SelectedValueProperty, ModeBinding); Binding PosYBinding = new Binding("PosY"); PosYBinding.Source = this.movingText; PosYBinding.Mode = BindingMode.TwoWay; PosY.SetBinding(Slider.ValueProperty, PosYBinding); Binding PosXBinding = new Binding("PosX"); PosXBinding.Source = this.movingText; PosXBinding.Mode = BindingMode.TwoWay; PosX.SetBinding(Slider.ValueProperty, PosXBinding); }
/// <summary> /// <list type="bullet"> /// <item> /// <description>AuroraWindow size is suitet to the user display</description> /// </item> /// <item> /// <description>The rgb mask and brigthness is set to 256 default</description> /// </item> /// <item> /// <description>The monitorImg <see cref=""/> gets initialised in proportion to the AuroraWindow </description> /// </item> /// <item> /// <description>The portWindow <seealso cref=""/> is initialised and the eventhandler data changed add, which is interrupted if the connection /// is cancelated or startet</description> /// </item> /// <item> /// <description>A very important point in InitMainWindow is to set the monitorImg.Source to monitor, otherwise nothing appears on the surface</description> /// </item> /// <item> /// <description>The RenderOptions.SetEdgeMode(monitorImg, EdgeMode.Aliased) EdgeMode property squares the pixel and guarantes clear edges on the 68 x 42 resolution</description> /// </item> /// <item> /// <description>The monitorTimer.Tick event has a frequence of 40 Hz</description> /// </item> /// </list> /// </summary> public void InitMainWindow() { Point screenSize = new Point(System.Windows.SystemParameters.FullPrimaryScreenWidth, System.Windows.SystemParameters.FullPrimaryScreenHeight); AuroraWindow.Width = screenSize.X * 0.4; AuroraWindow.Height = screenSize.Y * 0.9; redMask = 255; greenMask = 255; blueMask = 255; bright = 255; monitorImg.Width = AuroraWindow.Width * 0.85; monitorImg.Height = monitorImg.Width / 1.618; //Das SerialportWindow initialisiern portWindow = new PortWindow(); portWindow.data.Changed += new ChangedEventhandler(StatusChanged); //Das Rechteck für die Blit funktion festlegen r = new Rect(0, 0, 68, 42); //Writeable Bitmaps initialisiern monitor = BitmapFactory.New(68, 42); drawlayer = BitmapFactory.New(68, 42); monitorImg.Source = monitor; RenderOptions.SetBitmapScalingMode(monitorImg, BitmapScalingMode.NearestNeighbor); RenderOptions.SetEdgeMode(monitorImg, EdgeMode.Aliased); monitorTimer = new DispatcherTimer(DispatcherPriority.Render); monitorTimer.Interval = new TimeSpan(0, 0, 0, 0, 25); monitorTimer.Tick += monitorTimer_Tick; monitorTimer.Start(); bitmapbuffer = new Byte[monitor.ToByteArray().Length]; CentralMonitor.IsEnabled = false; runningTask = RunningTask.Effect; filterBitmap = BitmapFactory.New(68, 42); //Init Objects and Options Windows expandingObjects = new ExpandingObjects(monitor); expandingObjectsWindow = new ExpandingObjectsOptionsWindow(expandingObjects); movingText = new MovingText(monitor); movingTextOptionWindow = new MovingTextOptionsWindow(movingText); plasma = new Plasma(monitor); plasmaOptionWindow = new PlasmaOptionsWindow(plasma); colorGradient = new ColorGradient(monitor); gradientOptionWindow = new GradientColorOptionsWindow(colorGradient); StickyWindow.RegisterExternalReferenceForm(this); //Bluetooth Event listening RgbLibrary.Bluetooth.Instance.CommandControlChange += new Bluetooth.PropertyChangeHandler(Bluetooth_Command_Listener); }