public PlasmaOptionsWindow(Plasma p)
        {
            InitializeComponent();
            this.SizeToContent = System.Windows.SizeToContent.WidthAndHeight;
            this.p = p;
               // this.cg = cg;
            //Binding ObjectBinding = new Binding("GradientMode");
            //ObjectBinding.Source = this.cg;
            //ObjectBinding.Mode = BindingMode.TwoWay;
            //Selected_Objects.SetBinding(ComboBox.TextProperty, ObjectBinding);

            Binding ColorPaletteBinding = new Binding("ColorPalette");
            ColorPaletteBinding.Source = this.p;
            ColorPaletteBinding.Mode = BindingMode.TwoWay;
            Palettes.SetBinding(ComboBox.TextProperty, ColorPaletteBinding);
        }
示例#2
0
        /// <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);
        }