示例#1
0
 public void Draw(StreamDeckSharp.IStreamDeck deck)
 {
     if (theBitmap != null)
     {
         if (deck != null)
         {
             deck.SetKeyBitmap(ButtonId, StreamDeckSharp.KeyBitmap.FromRawBitmap(StreamDeckSharp.Extensions.StreamDeckFullScreenDrawingExtension.GetSmallRgbArray(theBitmap)));
         }
     }
 }
 public StreamDeckSharp.IStreamDeck getDeck()
 {
     if (deck == null)
     {
         try
         {
             deck = StreamDeckSharp.StreamDeck.OpenDevice();
             deck.ConnectionStateChanged += Deck_ConnectionStateChanged;
             deck.KeyStateChanged        += Deck_KeyStateChanged;
             if (ConnectionChanged != null)
             {
                 ConnectionChanged(this, new StreamDeckSharp.ConnectionEventArgs(deck.IsConnected));
             }
         }
         catch
         {
         }
     }
     return(deck);
 }
示例#3
0
 public abstract void Process(StreamDeckSharp.IStreamDeck deck);
示例#4
0
        private void Wrk_DoWork(object sender, DoWorkEventArgs e)
        {
            if (System.IO.File.Exists("settingswebcam.txt"))
            {
                try
                {
                    List <WebcamFullScreen> wfs = Newtonsoft.Json.JsonConvert.DeserializeObject <List <WebcamFullScreen> >(System.IO.File.ReadAllText("settingswebcam.txt"));
                    foreach (WebcamFullScreen wf in wfs)
                    {
                        wf.HookEvents();
                    }
                    toProcess.AddRange(wfs);
                }
                catch (Exception exc)
                {
                }
            }
            if (System.IO.File.Exists("settingsvumeter.txt"))
            {
                try
                {
                    toProcess.AddRange(Newtonsoft.Json.JsonConvert.DeserializeObject <List <VUMeter> >(System.IO.File.ReadAllText("settingsvumeter.txt")));
                }
                catch (Exception exc)
                {
                }
            }


            while (!this.Disposing)
            {
                btn0.SuspendLayout();
                btn1.SuspendLayout();
                btn2.SuspendLayout();
                btn3.SuspendLayout();
                btn4.SuspendLayout();
                btn5.SuspendLayout();
                btn6.SuspendLayout();
                btn7.SuspendLayout();
                btn8.SuspendLayout();
                btn9.SuspendLayout();
                btn10.SuspendLayout();
                btn11.SuspendLayout();
                btn12.SuspendLayout();
                btn13.SuspendLayout();
                btn14.SuspendLayout();
                try
                {
                    StreamDeckSharp.IStreamDeck deck = StreamDeckWrapper.getInstance().getDeck();
                    foreach (Job j in toProcess)
                    {
                        j.Process(deck);
                        j.Draw(deck);
                        switch (j.ButtonId)
                        {
                        case 0:

                            btn0.Text = "";
                            btn0.CreateGraphics().DrawImage(j.theBitmap, 0, 0, btn0.Width, btn0.Height);
                            break;

                        case 1:
                            btn1.Text = "";
                            btn1.CreateGraphics().DrawImage(j.theBitmap, 0, 0, btn0.Width, btn0.Height);
                            break;

                        case 2:
                            btn2.Text = "";
                            btn2.CreateGraphics().DrawImage(j.theBitmap, 0, 0, btn0.Width, btn0.Height);
                            break;

                        case 3:
                            btn3.Text = "";
                            btn3.CreateGraphics().DrawImage(j.theBitmap, 0, 0, btn0.Width, btn0.Height);
                            break;

                        case 4:
                            btn4.Text = "";
                            btn4.CreateGraphics().DrawImage(j.theBitmap, 0, 0, btn0.Width, btn0.Height);
                            break;

                        case 5:
                            btn5.Text = "";
                            btn5.CreateGraphics().DrawImage(j.theBitmap, 0, 0, btn0.Width, btn0.Height);
                            break;

                        case 6:
                            btn6.Text = "";
                            btn6.CreateGraphics().DrawImage(j.theBitmap, 0, 0, btn0.Width, btn0.Height);
                            break;

                        case 7:
                            btn7.Text = "";
                            btn7.CreateGraphics().DrawImage(j.theBitmap, 0, 0, btn0.Width, btn0.Height);
                            break;

                        case 8:
                            btn8.Text = "";
                            btn8.CreateGraphics().DrawImage(j.theBitmap, 0, 0, btn0.Width, btn0.Height);
                            break;

                        case 9:
                            btn9.Text = "";
                            btn9.CreateGraphics().DrawImage(j.theBitmap, 0, 0, btn0.Width, btn0.Height);
                            break;

                        case 10:
                            btn10.Text = "";
                            btn10.CreateGraphics().DrawImage(j.theBitmap, 0, 0, btn0.Width, btn0.Height);
                            break;

                        case 11:
                            btn11.Text = "";
                            btn11.CreateGraphics().DrawImage(j.theBitmap, 0, 0, btn0.Width, btn0.Height);
                            break;

                        case 12:
                            btn12.Text = "";
                            btn12.CreateGraphics().DrawImage(j.theBitmap, 0, 0, btn0.Width, btn0.Height);
                            break;

                        case 13:
                            btn13.Text = "";
                            btn13.CreateGraphics().DrawImage(j.theBitmap, 0, 0, btn0.Width, btn0.Height);
                            break;

                        case 14:
                            btn14.Text = "";
                            btn14.CreateGraphics().DrawImage(j.theBitmap, 0, 0, btn0.Width, btn0.Height);
                            break;
                        }
                    }
                }
                catch (Exception exc)
                {
                }

                btn0.ResumeLayout();
                btn1.ResumeLayout();
                btn2.ResumeLayout();
                btn3.ResumeLayout();
                btn4.ResumeLayout();
                btn5.ResumeLayout();
                btn6.ResumeLayout();
                btn7.ResumeLayout();
                btn8.ResumeLayout();
                btn9.ResumeLayout();
                btn10.ResumeLayout();
                btn11.ResumeLayout();
                btn12.ResumeLayout();
                btn13.ResumeLayout();
                btn14.ResumeLayout();
                Application.DoEvents();
                System.Threading.Thread.Sleep(100);
            }
        }