Esempio n. 1
0
        protected override void OnStart(string[] args)
        {
            //string TESTSTRING = string.Empty;
            try
            {
                ///SlideBar settings
                ///
                MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
                device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);

                //TESTSTRING = "MMDevice initialised.";

                SB = new SlideBar(SlideBar_HandleEvent, true);

                DisableTouchScreen(false);
                //Record_Brightness.Entrance();
                SystemEvents.PowerModeChanged += OnPowerChange;
            }
            catch (Exception ex)
            {
                string LogPath = Directory.GetCurrentDirectory() + "\\DOSSTONED_BG.txt";
                System.IO.File.AppendAllText(LogPath,
                                             DateTime.Now + "\r\n"
                                             + ex.Message + "\r\n"
                                             + ex.StackTrace + "\r\n"
                                             + "\r\n");
                Stop();
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            //SlideBar.SlideBarData sbData = new SlideBar.SlideBarData();
            //SlideBar sb = new SlideBar(false);
            //sb.DebugInfoEvent += new DebugInfoHandler(sb_DebugInfoEvent);
            //sb.sbArriveEvent += new SlideBarEventHandler(sb_sbArriveEvent);
            Console.WriteLine("initialising...");

            sb1 = new SlideBar(new SlideBarEventCallback(sb_sbArriveEvent), true);
            sb1.DebugInfoEvent += new DebugInfoHandler(sb1_DebugInfoEvent);
            Console.WriteLine("initialised.");

            /// control the breath effect of the 2 lights
            /// BREATH_OFF
            //sb1.SetSlideBarStatus(1, 0);
            /// BREATH_ON
            //sb1.SetSlideBarStatus(1, 1);

            /// CONNECT
            //sb1.SetSlideBarStatus(1, 16);
            /// DISCONNECT
            //sb1.SetSlideBarStatus(1, 17);

            /// LED_ON
            //sb1.SetSlideBarStatus(1, 32);
            /// LED_OFF
            //sb1.SetSlideBarStatus(1, 33);


            //MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
            //device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
            //Console.WriteLine(device.AudioEndpointVolume.MasterVolumeLevelScalar);

            Console.ReadKey();
        }
Esempio n. 3
0
        public override void Initialize(ContentManager content, GraphicsDevice graphics)
        {
            this.graphics = graphics;
            SpriteFont textFont      = content.Load <SpriteFont>("Fonts/ComicSansMS18");
            SpriteFont titleFont     = content.Load <SpriteFont>("Fonts/ComicSansMS32");
            Texture2D  barTexture    = content.Load <Texture2D>("Sprites/VolumeBar");
            Texture2D  markerTexture = content.Load <Texture2D>("Sprites/VolumeMark");


            title = new Text("Audio", titleFont, new Vector2(0, 0));

            musicVolumeText = new Text("Music Volume:", textFont);
            musicVolumeBar  = new SlideBar(barTexture, markerTexture, new Rectangle(300, 100, 400, 50), new Rectangle(0, 0, 30, 30), 30);
            musicVolumeText.CenterVertically(musicVolumeBar.Bar.Bounds, 80);
            musicVolumeValue             = new Text("", textFont);
            musicVolumeValue.TextMessage = musicVolumeBar.Value.ToString();
            musicVolumeValue.Center(new Rectangle(725, 100, 50, 50));
            musicVolumeBar.ValueChange += On_MusicVolumeChange;

            soundFXVolumeText = new Text("SoundFX Volume:", textFont);
            soundFXVolumeBar  = new SlideBar(barTexture, markerTexture, new Rectangle(300, 200, 400, 50), new Rectangle(0, 0, 30, 30), 30);
            soundFXVolumeText.CenterVertically(soundFXVolumeBar.Bar.Bounds, 100);
            soundFXVolumeValue             = new Text("", textFont);
            soundFXVolumeValue.TextMessage = soundFXVolumeBar.Value.ToString();
            soundFXVolumeValue.Center(new Rectangle(725, 200, 50, 50));
            soundFXVolumeBar.ValueChange += On_SoundFXVolumeChange;
        }
Esempio n. 4
0
        public void Initialize(ContentManager content, GraphicsDevice graphics)
        {
            //Background
            background = new Sprite2D(content.Load <Texture2D>("Sprites/ColorChooserBackground"), new Rectangle(585, 100, 250, 200));

            //Extra
            exitBtn        = new Button(new Sprite2D(content.Load <Texture2D>("Sprites/XMark"), new Rectangle(background.Bounds.X, background.Bounds.Y, 20, 20)));
            exitBtn.Click += new EventHandler((sender, e) => { OnExitButtonClick(); });

            //RGB
            slideTexture       = content.Load <Texture2D>("Sprites/Colorbar");
            markTexture        = content.Load <Texture2D>("Sprites/ColorMarker");
            red                = new SlideBar(slideTexture, markTexture, new Rectangle(background.Bounds.X + 25, background.Bounds.Y + 28, 200, 30), new Rectangle(0, 0, 10, 30), 0, 0);
            green              = new SlideBar(slideTexture, markTexture, new Rectangle(background.Bounds.X + 25, background.Bounds.Y + 28 + 28 + 30, 200, 30), new Rectangle(0, 0, 10, 30), 0, 0);
            blue               = new SlideBar(slideTexture, markTexture, new Rectangle(background.Bounds.X + 25, background.Bounds.Y + 28 + 28 + 28 + 60, 200, 30), new Rectangle(0, 0, 10, 30), 0, 0);
            red.UpperRange     = 255;
            green.UpperRange   = 255;
            blue.UpperRange    = 255;
            red.ValueChange   += On_ValueChange;
            blue.ValueChange  += On_ValueChange;
            green.ValueChange += On_ValueChange;
            green.SlideColor   = Color.Green;
            red.SlideColor     = Color.Red;
            blue.SlideColor    = Color.Blue;
        }
Esempio n. 5
0
        ///语音部分///static private SpeechSynthesizer speech = new SpeechSynthesizer();


        /// <summary>
        /// The main entry point for the application.
        /// </summary>
//        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);



            #region 初始化组件
            notifyIcon提示 = new NotifyIcon();
            /// 初始化部分组件
            notifyIconMenu = new ContextMenuStrip();


            notifyIcon提示.Icon            = Properties.Resources.SlideBar;
            notifyIcon提示.BalloonTipIcon  = ToolTipIcon.Warning;
            notifyIcon提示.BalloonTipTitle = "提示";
            notifyIcon提示.Visible         = true;

            menuItemExit = new ToolStripMenuItem("Exit", null, menuExit);
            menuItemUseForVolumeControl = new ToolStripMenuItem("Control Volume", null, menuVolumeControl);
            menuItemUseForBrightness    = new ToolStripMenuItem("Control Brightness", null, menuBrightness);

            menuItemUseForBrightness.CheckedChanged    += new EventHandler(menuItemUseForBrightness_CheckedChanged);
            menuItemUseForVolumeControl.CheckedChanged += new EventHandler(menuItemUseForVolumeControl_CheckedChanged);

            notifyIconMenu.Items.Add(menuItemUseForBrightness);
            notifyIconMenu.Items.Add(menuItemUseForVolumeControl);
            notifyIconMenu.Items.Add(menuItemExit);

            notifyIcon提示.Text             = "正在启动相应硬件……请稍后";
            notifyIcon提示.ContextMenuStrip = notifyIconMenu;

            #endregion
            ///语音部分///speech.Volume = 10;
            notifyIcon提示.ShowBalloonTip(1000, "提示", "正在启动程序", ToolTipIcon.Info);

            slideBar = new SlideBar(new SlideBarEventCallback(sb_sbArriveEvent), true);
            MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
            volumeDevice = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);

            notifyIcon提示.ShowBalloonTip(1000, "提示", "程序已启动", ToolTipIcon.Info);


            Application.Run();

            ///语音部分///speech.Speak("Bye bye.");

            notifyIcon提示.Dispose(); // 消除提示图标
            /// 这个地方放置退出登录的操作
        }
Esempio n. 6
0
        //const int totalVolumeNumber = 3;
        //static float[] volumes = new float[totalVolumeNumber];


        static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            sb = new SlideBar(true);
            sb.sbArriveEvent += new SlideBarEventHandler(sb_sbArriveEvent);
            MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();

            device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
            //sb.SetSlideBarStatus(1, 0);
            //for (int i = 0; i < volumes.Length;i++ )
            //{
            //    volumes[i] = device.AudioEndpointVolume.MasterVolumeLevelScalar;
            //}
            Application.Run();
        }
Esempio n. 7
0
        public ProgressNSliderTestDialog()
            : base("Progress and Slider Test", 150, 150, 320, 200)
        {
            /*
             *          borderLayout=new BorderLayout(16,16,16,16,8);
             *          borderLayout.SouthHAlignment = EHorizontalAlignment.HRight;
             *
             *          closeButton=new Button("Close");
             *          closeButton.LayoutProperty = EArea.South;
             *
             *          valueLabel=new Label("Value:0%");
             *          valueLabel.LayoutProperty = EArea.North;
             *
             *          centerPanel=new Panel();
             *          centerGirdLayout=new GirdLayout(2,1);
             *          centerPanel.Layout = centerGirdLayout;
             *
             *          horizontalPBar=new ProgressBar(0.0f,100.0f,0.0f);
             *          horizontalSBar=new SlideBar(0.0f,100.0f,0.0f);
             *
             *          centerPanel.Add(horizontalPBar);
             *          centerPanel.Add(horizontalSBar);
             *          centerPanel.LayoutProperty = EArea.Center;
             *          centerPanel.Pack();
             *
             *          verticalPBar=new ProgressBar(0.0f,100.0f,0.0f, ETypeOrientation.Vertical);
             *          verticalSBar=new SlideBar(0.0f,100.0f,0.0f, ETypeOrientation.Vertical);
             *
             *          verticalPBar.LayoutProperty = EArea.East;
             * verticalSBar.LayoutProperty = EArea.East;
             *
             *          Add(closeButton);
             *          Add(valueLabel);
             *          Add(centerPanel);
             *          Add(verticalPBar);
             *          Add(verticalSBar);
             *
             *          Layout = borderLayout;
             *
             *          Pack();
             */

            girdLayout = new GirdLayout(4, 1);

            girdLayout.SetHorizontalAlignment(0, 0, EHAlignment.HLeft);
            girdLayout.SetHorizontalAlignment(1, 0, EHAlignment.HCenter);
            girdLayout.SetHorizontalAlignment(2, 0, EHAlignment.HCenter);
            girdLayout.SetHorizontalAlignment(3, 0, EHAlignment.HRight);

            girdLayout.Right  = 16;
            girdLayout.Left   = 16;
            girdLayout.Top    = 8;
            girdLayout.Bottom = 8;
            girdLayout.Spacer = 4;

            closeButton = new Button("Close");
            closeButton.LayoutProperty = EArea.South;

            valueLabel = new Label("Value: 0%");
            valueLabel.LayoutProperty = EArea.North;

            horizontalPBar = new ProgressBar(0.0f, 100.0f, ETypeOrientation.Horizontal);
            horizontalSBar = new SlideBar(0.0f, 100.0f, ETypeOrientation.Horizontal);

            Button button1 = new Button("button1");
            Button button2 = new Button("button2");

            Add(valueLabel);
            Add(horizontalPBar);
            Add(horizontalSBar);
            //Add(button1);
            //Add(button2);
            Add(closeButton);

            Layout = girdLayout;

            Pack();

            horizontalSBar.Slider.DragMovedEvent += new DragMovedHandler(Slider_DragMovedEvent);
            closeButton.MouseReleasedEvent       += new MouseReleasedHandler(closeButton_MouseReleasedEvent);
        }
Esempio n. 8
0
        private void SB_Controller_Load(object sender, EventArgs e)
        {
            sb = new SlideBar(true);
            sb.sbArriveEvent += new SlideBarEventHandler(sb_sbArriveEvent);
            byte[] IObytes = sb.GetSlideBarStatus();
            foreach (SlideBar.Event sbEvt in Enum.GetValues(typeof(SlideBar.Event)))
            {
                CheckBox cb = new CheckBox();
                cb.Text = sbEvt.ToString();
                /// add the checkstatus to current checkbox
                switch (sbEvt)
                {
                case SlideBar.Event.SlideBarLightSwitch:
                case SlideBar.Event.ServiceKey:
                    cb.Checked = (IObytes[64 + (int)sbEvt] != 0);
                    break;

                case SlideBar.Event.AP00:
                case SlideBar.Event.AP01:
                case SlideBar.Event.AP02:
                case SlideBar.Event.AP03:
                case SlideBar.Event.AP04:
                case SlideBar.Event.AP05:
                case SlideBar.Event.AP06:
                case SlideBar.Event.AP07:
                    cb.Checked = (((int)IObytes[66]) >> ((int)sbEvt - 8)) % 2 != 0;
                    break;
                }
                cb.CheckedChanged += new EventHandler(cb_CheckedChanged);
                flowLayoutPanelControls.Controls.Add(cb);
            }

            for (int i = 0; i < IObytes.Length; i++)
            {
                labelIOBytes[i]       = new Label();
                labelIOBytes[i].Text  = IObytes[i].ToString("X2");
                labelIOBytes[i].Width = 21;
                //labelIOBytes[i].Click += new EventHandler(SB_Controller_Click);
                labelIOBytes[i].TextChanged += new EventHandler(SB_Controller_TextChanged);
                flowLayoutPanelIOBytes.Controls.Add(labelIOBytes[i]);

                labelInputBytes[i]              = new Label();
                labelInputBytes[i].Width        = 21;
                labelInputBytes[i].Text         = "00";
                labelInputBytes[i].Click       += new EventHandler(SB_Controller_Click);
                labelInputBytes[i].TextChanged += new EventHandler(SB_Controller_TextChanged);
                flowLayoutPanelInputBytes.Controls.Add(labelInputBytes[i]);
            }
            for (int i = 0; i < labelEvtBytes.Length; i++)
            {
                labelEvtBytes[i]              = new Label();
                labelEvtBytes[i].Width        = 21;
                labelEvtBytes[i].TextChanged += new EventHandler(SB_Controller_TextChanged);
                flowLayoutPanelEventBytes.Controls.Add(labelEvtBytes[i]);
            }

            //labelInputBytes[8].Text = "09";
            //labelInputBytes[85].Text = "01";
            //labelInputBytes[86].Text = "01";
            //labelInputBytes[66].Text = "01";
            //labelInputBytes[16].Text = "01";
            //labelInputBytes[10].Text = "01";
            //labelInputBytes[9].Text = "03";
            //labelInputBytes[0].Text = "01";
            //labelInputBytes[1].Text = "10";



            //labelInputBytes[0].ForeColor = Color.Blue;
            //labelInputBytes[1].ForeColor = Color.Blue;
            //labelInputBytes[8].ForeColor = Color.Blue;
            //labelInputBytes[9].ForeColor = Color.Blue;
            //labelInputBytes[10].ForeColor = Color.Blue;
            //labelInputBytes[16].ForeColor = Color.Blue;
            //labelInputBytes[66].ForeColor = Color.Blue;
            //labelInputBytes[85].ForeColor = Color.Blue;
            //labelInputBytes[86].ForeColor = Color.Blue;
        }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     SB = new SlideBar(SlideBarHandler, true);
     AeroGlass.ExtendGlassFrame(this, new Thickness(-1));
 }
Esempio n. 10
0
 public abstract void PaintSlideBar(SlideBar component);