Example #1
0
        private void SetChatAddress(string chatChannel)
        {
            string username = chatChannel;

            if (chatChannel.Contains("/"))
            {
                username = chatChannel.Split('/').Last();
            }

            string fade = SettingsSingleton.Instance.genSettings.FadeTime;

            if (!SettingsSingleton.Instance.genSettings.FadeChat)
            {
                fade = "false";
            }

            string theme = string.Empty;

            if ((SettingsSingleton.Instance.genSettings.ThemeIndex >= 0) && (SettingsSingleton.Instance.genSettings.ThemeIndex < KapChat.Themes.Count))
            {
                theme = KapChat.Themes[SettingsSingleton.Instance.genSettings.ThemeIndex];
            }

            string url = @"https://www.nightdev.com/hosted/obschat/?";

            url += @"theme=" + theme;
            url += @"&channel=" + username;
            url += @"&fade=" + fade;
            url += @"&bot_activity=" + SettingsSingleton.Instance.genSettings.ShowBotActivity.ToString();
            url += @"&prevent_clipping=false";
            Browser1.Load(url);
        }
Example #2
0
        private void SetupBrowser()
        {
            drawBorders();

            if (this.genSettings.CustomWindows != null)
            {
                foreach (string url in this.genSettings.CustomWindows)
                {
                    OpenNewCustomWindow(url);
                }
            }

            this.Browser1.ZoomLevelIncrement = 0.25;

            if (this.genSettings.isCustomURL && !string.IsNullOrWhiteSpace(this.genSettings.CustomURL))
            {
                SetCustomChatAddress(this.genSettings.CustomURL);
            }
            else if (!string.IsNullOrWhiteSpace(this.genSettings.Username))
            {
                SetChatAddress(this.genSettings.Username);
            }
            else
            {
                Uri    startupPath = new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
                string address     = System.IO.Path.GetDirectoryName(startupPath.LocalPath) + "\\index.html";
                Browser1.Load(address);

                //CefSharp.WebBrowserExtensions.LoadHtml(Browser1,
                //"<html><body style=\"font-size: x-large; color: white; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; \">Load a channel to connect to by right-clicking the tray icon.<br /><br />You can move and resize the window, then press the [o] button to hide borders, or use the tray icon menu.</body></html>");
            }
        }
Example #3
0
        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            //WebClient client = new WebClient();
            //var bytes = client.DownloadData("description");
            //var stream = new System.IO.MemoryStream(bytes);

            //Image url = Image.FromStream(stream); // 1 способ

            Browser1.Navigate("url");
        }
Example #4
0
        private void SetChatAddress(string chatChannel)
        {
            string url = @"https://www.nightdev.com/hosted/obschat/?theme=bttv_blackchat&channel=";

            url += chatChannel;
            url += @"&fade=" + fade;
            url += @"&bot_activity=" + bot_activity;
            url += @"&prevent_clipping=false";
            Browser1.Load(url);
        }
        private void exportButton_Click(object sender, RoutedEventArgs e)
        {
            var topLeftCorner   = Browser1.PointToScreen(new System.Windows.Point(0, 0));
            var topLeftGdiPoint = new System.Drawing.Point((int)topLeftCorner.X, (int)topLeftCorner.Y);
            var size            = new System.Drawing.Size((int)Browser1.ActualWidth, (int)Browser1.ActualHeight);

            var screenShot = new Bitmap((int)Browser1.ActualWidth, (int)Browser1.ActualHeight);

            using (var graphics = Graphics.FromImage(screenShot))
            {
                graphics.CopyFromScreen(topLeftGdiPoint, new System.Drawing.Point(),
                                        size, CopyPixelOperation.SourceCopy);
            }
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter = "Png Image|*.png";
            saveFileDialog1.Title  = "Save an Image File";
            saveFileDialog1.ShowDialog();
            if (saveFileDialog1.FileName != "")
            {
                screenShot.Save(saveFileDialog1.FileName, ImageFormat.Png);
                MessageBox.Show("Saved image succesfully to: " + saveFileDialog1.FileName);
            }
        }
Example #6
0
        private void SetupBrowser()
        {
            if (!this.Browser1.IsInitialized)
            {
                MessageBox.Show(
                    "Error setting up source. The component was not initialized",
                    "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK
                    );
                return;
            }

            this.bgColor    = new SolidColorBrush(Color.FromArgb(SettingsSingleton.Instance.genSettings.OpacityLevel, 0, 0, 0));
            this.Background = this.bgColor;
            this.cOpacity   = SettingsSingleton.Instance.genSettings.OpacityLevel;

            if (SettingsSingleton.Instance.genSettings.AutoHideBorders)
            {
                hideBorders();
            }
            else
            {
                drawBorders();
            }

            if (SettingsSingleton.Instance.genSettings.ChatNotificationSound.ToLower() != "none")
            {
                Uri    startupPath = new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
                string file        = System.IO.Path.GetDirectoryName(startupPath.LocalPath) + "\\assets\\" + SettingsSingleton.Instance.genSettings.ChatNotificationSound + ".wav";
                if (System.IO.File.Exists(file))
                {
                    this.jsCallbackFunctions.MediaFile = file;
                }
            }

            if (SettingsSingleton.Instance.genSettings.CustomWindows != null)
            {
                foreach (string url in SettingsSingleton.Instance.genSettings.CustomWindows)
                {
                    OpenNewCustomWindow(url, SettingsSingleton.Instance.genSettings.AutoHideBorders);
                }
            }

            this.Browser1.ZoomLevelIncrement = 0.25;

            if ((SettingsSingleton.Instance.genSettings.ChatType == (int)ChatTypes.CustomURL) && (!string.IsNullOrWhiteSpace(SettingsSingleton.Instance.genSettings.CustomURL)))
            {
                this.currentChat = new CustomURLChat();
                SetCustomChatAddress(SettingsSingleton.Instance.genSettings.CustomURL);
            }
            else if ((SettingsSingleton.Instance.genSettings.ChatType == (int)ChatTypes.TwitchPopout) && (!string.IsNullOrEmpty(SettingsSingleton.Instance.genSettings.Username)))
            {
                this.currentChat = new CustomURLChat();
                SetCustomChatAddress("https://www.twitch.tv/popout/" + SettingsSingleton.Instance.genSettings.Username + "/chat?popout=");
            }
            else if (!string.IsNullOrWhiteSpace(SettingsSingleton.Instance.genSettings.Username))
            { // TODO: need to clean this up to determine which type of chat to load better
                if (SettingsSingleton.Instance.genSettings.ChatType == (int)ChatTypes.KapChat)
                {
                    this.currentChat = new Chats.KapChat();
                    SetChatAddress(SettingsSingleton.Instance.genSettings.Username);
                }
                else if (SettingsSingleton.Instance.genSettings.ChatType == (int)ChatTypes.jChat)
                {
                    this.currentChat = new jChat();
                    SetCustomChatAddress(SettingsSingleton.Instance.genSettings.jChatURL);
                }
                else
                {
                    Uri    startupPath = new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
                    string address     = System.IO.Path.GetDirectoryName(startupPath.LocalPath) + "\\index.html";
                    Browser1.Load(address);
                }

                if (SettingsSingleton.Instance.genSettings.RedemptionsEnabled)
                {
                    SetupPubSubRedemptions();
                }
            }
            else if (SettingsSingleton.Instance.genSettings.ChatType == (int)ChatTypes.jChat)
            { // TODO: need to clean this up to determine which type of chat to load better
                this.currentChat = new jChat();
                SetCustomChatAddress(SettingsSingleton.Instance.genSettings.jChatURL);
            }
            else
            {
                Uri    startupPath = new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
                string address     = System.IO.Path.GetDirectoryName(startupPath.LocalPath) + "\\index.html";
                Browser1.Load(address);

                //CefSharp.WebBrowserExtensions.LoadHtml(Browser1,
                //"<html><body style=\"font-size: x-large; color: white; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; \">Load a channel to connect to by right-clicking the tray icon.<br /><br />You can move and resize the window, then press the [o] button to hide borders, or use the tray icon menu.</body></html>");
            }
        }
Example #7
0
 private void SetCustomChatAddress(string url)
 {
     Browser1.Load(url);
 }
Example #8
0
 private void button_devtools_Click(object sender, System.EventArgs e)
 {
     Browser1.ShowDevTools();
     Browser2.ShowDevTools();
 }
Example #9
0
 private void button_refresh_Click(object sender, System.EventArgs e)
 {
     Browser1.ExecuteScriptAsync("location.reload()");
     Browser2.ExecuteScriptAsync("location.reload()");
     VRCXVR.Refresh();
 }
Example #10
0
 public void Dispose()
 {
     Browser1.Close();
 }
Example #11
0
        /// <summary>
        /// Handles the body frame data arriving from the sensor and updates the associated gesture detector object for each body
        /// </summary>
        /// <param name="sender">object sending the event</param>
        /// <param name="e">event arguments</param>
        private void Reader_BodyFrameArrived(object sender, BodyFrameArrivedEventArgs e)
        {
            bool dataReceived = false;


            using (BodyFrame bodyFrame = e.FrameReference.AcquireFrame())
            {
                if (bodyFrame != null)
                {
                    if (this.bodies == null)
                    {
                        // creates an array of 6 bodies, which is the max number of bodies that Kinect can track simultaneously
                        this.bodies = new Body[bodyFrame.BodyCount];
                    }

                    // The first time GetAndRefreshBodyData is called, Kinect will allocate each Body in the array.
                    // As long as those body objects are not disposed and not set to null in the array,
                    // those body objects will be re-used.
                    bodyFrame.GetAndRefreshBodyData(this.bodies);
                    dataReceived = true;
                }
            }

            if (dataReceived)
            {
                // visualize the new body data
                int scene = this.kinectBodyView.UpdateBodyFrame(this.bodies);
                if (scene == 1)
                {
                    BrowserInit.Visibility = Visibility.Hidden;
                    BrowserInit.Navigate(new Uri("https://www.google.fr"));
                    finvideointro.Visibility = Visibility.Visible;
                }
                if (scene == 2)
                {
                    BrowserInit.Visibility = Visibility.Hidden;
                    BrowserInit.Navigate(new Uri("https://www.google.fr"));
                    actionmain.Visibility = Visibility.Visible;
                }
                if (scene == 3)
                {
                    if (videoPLayed == 0)
                    {
                        videoPLayed++;
                        actionmain.Visibility = Visibility.Hidden;
                        Browser1.Visibility   = Visibility.Visible;
                        //Browser1.Source = new Uri("https://www.youtube.com/");

                        Debug.Print("Astronaute");

                        this.Browser1.Navigate(new Uri("http://antoine.kairos-agency.com/kinect/"));
                    }
                }
                if (scene == 4 && videoDehors == 0)
                {
                    Debug.Print("Vidéo Finie");
                    Browser1.Visibility = Visibility.Hidden;
                    Browser1.Navigate(new Uri("https://www.google.fr"));
                    fondDecran2.Visibility = Visibility.Visible;
                    videoDehors++;
                }
                if (scene == 5 && quizz == 0)
                {
                    fondDecran2.Visibility = Visibility.Hidden;
                    quizzImage.Visibility  = Visibility.Visible;
                    quizz++;
                }

                // we may have lost/acquired bodies, so update the corresponding gesture detectors
                if (this.bodies != null)
                {
                    // loop through all bodies to see if any of the gesture detectors need to be updated
                    int maxBodies = this.kinectSensor.BodyFrameSource.BodyCount;
                    for (int i = 0; i < maxBodies; ++i)
                    {
                        Body  body       = this.bodies[i];
                        ulong trackingId = body.TrackingId;

                        // if the current body TrackingId changed, update the corresponding gesture detector with the new value
                        if (trackingId != this.gestureDetectorList[i].TrackingId)
                        {
                            this.gestureDetectorList[i].TrackingId = trackingId;

                            // if the current body is tracked, unpause its detector to get VisualGestureBuilderFrameArrived events
                            // if the current body is not tracked, pause its detector so we don't waste resources trying to get invalid gesture results
                            this.gestureDetectorList[i].IsPaused = trackingId == 0;
                        }
                    }
                }
            }
        }