public static StreamDeckWrapper getInstance()
 {
     if (instance == null)
     {
         instance = new StreamDeckWrapper();
     }
     return(instance);
 }
예제 #2
0
        public Form1()
        {
            InitializeComponent();

            this.Load        += Form1_Load;
            this.FormClosing += Form1_FormClosing;
            wrk.DoWork       += Wrk_DoWork;
            StreamDeckWrapper.getInstance().ConnectionChanged += Form1_ConnectionChanged;
            StreamDeckWrapper.getInstance().KeyStateChanged   += Form1_KeyStateChanged;
        }
예제 #3
0
 public override void Process(IStreamDeck deck)
 {
     if (!captureStarted)
     {
         try
         {
             cfs.StartFrameCapture();
             stopWatch.Start();
             captureStarted = true;
         }
         catch (Exception exc)
         {
         }
     }
     if (imgData.Length != 0)
     {
         // StreamDeckSharp.Extensions.StreamDeckFullScreenDrawingExtension.DrawFullScreenBitmap(deck, imgData);
     }
     if (enabled)
     {
         StreamDeckSharp.Extensions.StreamDeckFullScreenDrawingExtension.DrawFullScreenBitmap(StreamDeckWrapper.getInstance().getDeck(), imgData);
     }
 }
예제 #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);
            }
        }
예제 #5
0
        private void RemoveForIndex(int index)
        {
            List <Job> toRemove = new List <Job>();

            foreach (Job j in toProcess)
            {
                if (j.ButtonId == index)
                {
                    StreamDeckSharp.InterfaceExtensions.ClearKey(StreamDeckWrapper.getInstance().getDeck(), index);
                    toRemove.Add(j);
                }
            }
            foreach (Job j in toRemove)
            {
                toProcess.Remove(j);
            }
            switch (index)
            {
            case 0:
                btn0.Text = "0";
                break;

            case 1:
                btn1.Text = "1";
                break;

            case 2:
                btn2.Text = "2";
                break;

            case 3:
                btn3.Text = "3";
                break;

            case 4:
                btn4.Text = "4";
                break;

            case 5:
                btn5.Text = "5";
                break;

            case 6:
                btn6.Text = "6";
                break;

            case 7:
                btn7.Text = "7";
                break;

            case 8:
                btn8.Text = "8";
                break;

            case 9:
                btn9.Text = "9";
                break;

            case 10:
                btn10.Text = "10";
                break;

            case 11:
                btn11.Text = "11";
                break;

            case 12:
                btn12.Text = "12";
                break;

            case 13:
                btn13.Text = "13";
                break;

            case 14:
                btn14.Text = "14";
                break;
            }


            Save();
        }