Ejemplo n.º 1
0
        /// <summary>
        /// gets called when the mute checkbox is checked/unchecked. changes the mute status of a kinect client
        /// </summary>
        /// <param name="sender">the checkbox</param>
        /// <param name="e">unused params</param>
        private void _CheckboxMute_Checked(object sender, RoutedEventArgs e)
        {
            ConnectionStatusListviewItem obj = ((FrameworkElement)sender).DataContext as ConnectionStatusListviewItem;

            _DataManager.muteClient(obj.ID, (bool)((CheckBox)sender).IsChecked);

            if ((bool)((CheckBox)sender).IsChecked)
            {
                obj.backgroundMute = (ImageSource) new ImageSourceConverter().ConvertFrom(new Uri(@"pack://*****:*****@"pack://siteoforigin:,,,/Resources/video_256_green.png"));
            }
        }
Ejemplo n.º 2
0
        private void _ButtonSettings_Click(object sender, RoutedEventArgs e)
        {
            //fetch CCO data
            ConnectionStatusListviewItem obj = ((FrameworkElement)sender).DataContext as ConnectionStatusListviewItem;
            List <ClientConfigObject>    connectedClients = _DataManager.getCurrentKinectClients();

            ClientConfigObject clientConfig = connectedClients.Find(t => t.ID == obj.ID);

            //create settings window
            if (lastActiveSettingsWindow == null || !lastActiveSettingsWindow.IsLoaded)
            {
                lastActiveSettingsWindow = new ClientSettingsWindow(clientConfig);
                lastActiveSettingsWindow.OnConfigChangeEvent += lastActiveSettingsWindow_OnConfigChangeEvent;
            }
            UpdateClientConnectionSatus();
            lastActiveSettingsWindow.Show();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// gets called when the delete button is pressed. removes the client from the database
        /// </summary>
        /// <param name="sender">the button</param>
        /// <param name="e">unused params</param>
        private void _ButtonDelete_Click(object sender, RoutedEventArgs e)
        {
            ConnectionStatusListviewItem obj = ((FrameworkElement)sender).DataContext as ConnectionStatusListviewItem;

            MessageBoxResult res = MessageBox.Show("Do you really want to delete client \"" + obj.name + "\" from database?", "Delete client from database?", MessageBoxButton.YesNo);

            if (res == MessageBoxResult.Yes)
            {
                _DataManager.deleteClientFromDatabase(obj.ID);
            }

            // update the progress bar if it was the master kinect that was deleted
            if (obj.master == true)
            {
                masterSet = false;
                UpdateClientConnectionSatus();
            }
            UpdateClientConnectionSatus();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// the selection if the kinect is the master kinect for the alignment of the pictures
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _CheckboxMaster_Checked(object sender, RoutedEventArgs e)
        {
            ConnectionStatusListviewItem obj = ((FrameworkElement)sender).DataContext as ConnectionStatusListviewItem;
            List <ClientConfigObject>    connectedClients = _DataManager.getCurrentKinectClients();

            ClientConfigObject clientConfig = connectedClients.Find(t => t.ID == obj.ID);

            // resets all other kinects
            foreach (ClientConfigObject cco in connectedClients)
            {
                if (cco.ID == clientConfig.ID)
                {
                    _DataManager.masterKinect(cco, true);
                    masterSet = true;
                }
                else
                {
                    _DataManager.masterKinect(cco, false);
                }
            }
            UpdateClientConnectionSatus();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// gets called when the shutdown button is clicked. disconnects the client and tells him to stop sending pings
        /// </summary>
        /// <param name="sender">the button</param>
        /// <param name="e">unused params</param>
        private void _ButtonShutdown_Click(object sender, RoutedEventArgs e)
        {
            ConnectionStatusListviewItem obj = ((FrameworkElement)sender).DataContext as ConnectionStatusListviewItem;

            if (obj.CCO.clientRequestObject.isConnected)
            {
                MessageBoxResult res = MessageBox.Show("Do you really want to shutdown client \"" + obj.name + "\" ?", "Shutdown client?", MessageBoxButton.YesNo);
                if (res == MessageBoxResult.Yes)
                {
                    _DataManager.shutdownClient(obj.ID);
                    ((Button)sender).Content = (ImageSource) new ImageSourceConverter().ConvertFrom(new Uri(@"pack://*****:*****@"pack://siteoforigin:,,,/Resources/impressions_general_stop_256.png"));
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// updates the visible list of clients in the ConnectionStatusListView and
        /// implements the logic for the listview
        /// </summary>
        private void UpdateClientConnectionSatus()
        {
            List <ClientConfigObject> connectedClients = _DataManager.getCurrentKinectClients();

            this.Dispatcher.Invoke(() => {
                //connection status
                ImageSource conStatOrig, kinStatOrig;

                ConnectionStatusListView.Items.Clear();
                foreach (ClientConfigObject cco in connectedClients)
                {
                    //mute button
                    ImageSource bgm;
                    if (cco.clientRequestObject.isMuted)
                    {
                        bgm = (ImageSource) new ImageSourceConverter().ConvertFrom(new Uri(@"pack://*****:*****@"pack://siteoforigin:,,,/Resources/video_256_green.png"));
                    }

                    // kinect connection status
                    if (!statusList.Exists(t => t.clientID == cco.ID))
                    {
                        if (cco.clientRequestObject.isConnected)
                        {
                            conStatOrig = (ImageSource) new ImageSourceConverter().ConvertFrom(new Uri(@"pack://*****:*****@"pack://siteoforigin:,,,/Resources/disconnect_256_orange.png"));
                        }
                        else
                        {
                            conStatOrig = (ImageSource) new ImageSourceConverter().ConvertFrom(new Uri(@"pack://*****:*****@"pack://siteoforigin:,,,/Resources/disconnect_256_orange.png"));
                        }
                    }
                    else
                    {
                        KinectStatusPackage kSp = statusList.Find(t => t.clientID == cco.ID);
                        if (cco.clientRequestObject.isConnected && kSp.isKinectActive)
                        {
                            conStatOrig = (ImageSource) new ImageSourceConverter().ConvertFrom(new Uri(@"pack://*****:*****@"pack://siteoforigin:,,,/Resources/connect_256_green.png"));
                        }
                        else if (cco.clientRequestObject.isConnected && !kSp.isKinectActive)
                        {
                            conStatOrig = (ImageSource) new ImageSourceConverter().ConvertFrom(new Uri(@"pack://*****:*****@"pack://siteoforigin:,,,/Resources/disconnect_256_orange.png"));
                        }
                        else
                        {
                            conStatOrig = (ImageSource) new ImageSourceConverter().ConvertFrom(new Uri(@"pack://*****:*****@"pack://siteoforigin:,,,/Resources/disconnect_256_orange.png"));
                        }
                    }

                    //add item
                    ConnectionStatusListviewItem cl = new ConnectionStatusListviewItem()
                    {
                        CCO            = cco,
                        ID             = cco.ID,
                        name           = cco.name,
                        IP             = cco.ownIP,
                        kinStatus      = kinStatOrig,
                        conStatus      = conStatOrig,
                        master         = cco.clientKinectConfig.isMaster,
                        mute           = cco.clientRequestObject.isMuted,
                        backgroundMute = bgm,
                    };
                    ConnectionStatusListView.Items.Add(cl);
                }

                //check for calibrated planes
                planesSet = Config.ServerConfigManager._ServerConfigObject.serverAlgorithmConfig.calibratedPlanes.Exists(testc => testc.isFloor == true);
                if (planesSet == true)
                {
                    this._imagePlanesSet.Source = (ImageSource) new ImageSourceConverter().ConvertFrom(new Uri(@"pack://*****:*****@"pack://siteoforigin:,,,/Resources/cross_256_orange.png"));
                }

                //check for master
                masterSet = connectedClients.Exists(t => t.clientKinectConfig.isMaster == true);
                if (masterSet == true)
                {
                    this._imageMasterKinectSet.Source = (ImageSource) new ImageSourceConverter().ConvertFrom(new Uri(@"pack://*****:*****@"pack://siteoforigin:,,,/Resources/cross_256_orange.png"));
                }

                //check for reference table
                if (connectedClients.Count == 0)
                {
                    referenceTableSet = false;
                }
                else
                {
                    referenceTableSet = connectedClients.Where(t => t.clientKinectConfig.isMaster == false).All(t =>
                                                                                                                t.clientKinectConfig.transformationMatrix[0, 0] != 1 ||
                                                                                                                t.clientKinectConfig.transformationMatrix[1, 1] != 1 ||
                                                                                                                t.clientKinectConfig.transformationMatrix[2, 2] != 1);
                }

                if (referenceTableSet)
                {
                    this._imageReferenceTableSet.Source = (ImageSource) new ImageSourceConverter().ConvertFrom(new Uri(@"pack://*****:*****@"pack://siteoforigin:,,,/Resources/cross_256_orange.png"));
                }

                //logic for the usability of the calibration buttons
                if ((masterSet == true && referenceTableSet == true) || connectedClients.Count == 0)
                {
                    this._ButtonFetchData.IsEnabled = true;
                }
                else
                {
                    this._ButtonFetchData.IsEnabled = false;
                }

                if (masterSet == true || connectedClients.Count == 0)
                {
                    this._ButtonCalibrateAll.IsEnabled = true;
                }
                else
                {
                    this._ButtonCalibrateAll.IsEnabled = false;
                }

                if ((masterSet == true && planesSet == true && referenceTableSet == true) || connectedClients.Count == 0)
                {
                    this._ButtonScan.IsEnabled = true;
                }
                else
                {
                    this._ButtonScan.IsEnabled = false;
                }

                if ((_DataManager.currentReferenceCloud != null && masterSet == true || connectedClients.Count == 0))
                {
                    this._ButtonSelectPlanes.IsEnabled = true;
                }
                else
                {
                    this._ButtonSelectPlanes.IsEnabled = false;
                }

                if ((Config.ServerConfigManager._ServerConfigObject.serverAlgorithmConfig.calibratedPlanes.Count > 0 && _DataManager.currentReferenceCloud != null && masterSet == true) || connectedClients.Count == 0)
                {
                    this._ButtonEuclidianScan.IsEnabled = true;
                }
                else
                {
                    this._ButtonEuclidianScan.IsEnabled = false;
                }
            });
        }