Beispiel #1
0
        private void _connection_ConnectionStateChangedEventHandler(ConnectionStatuses status)
        {
            if (status == ConnectionStatuses.DISCONNECTED)
            {
                SelectedPrototype      = null;
                SelectedProcessToStart = null;

                Application.Current.Dispatcher.BeginInvoke(
                    DispatcherPriority.Background,
                    new Action(() =>
                {
                    ProcessCollection.Clear();
                    ProcessToStartCollection.Clear();
                    ProcessToStart      = "";
                    ProcessImage        = null;
                    _isImageTransfering = false;
                }));
            }

            ConnectionStatus = status;
            RefreshProperties();
        }
Beispiel #2
0
        protected override void AddProcessIcon(Message message)
        {
            if (message != null)
            {
                int processID;

                if (Int32.TryParse(Utils.GetTextBetween(message.Text, ConnectionService.PROCESS_START_DELIMITER, ConnectionService.PROCESS_END_DELIMITER), out processID))
                {
                    String imageText = message.Text.Substring(0, message.Text.IndexOf(ConnectionService.PROCESS_START_DELIMITER));

                    Bitmap bitmap = Utils.Base64StringToBitmap(imageText);

                    if (bitmap != null)
                    {
                        ProcessPrototype prototype = null;

                        prototype = ProcessCollection.FirstOrDefault(x => x.ID == processID);

                        if (prototype == null)
                        {
                            prototype = ProcessToStartCollection.FirstOrDefault(x => x.ID == processID);
                        }

                        if (prototype != null)
                        {
                            ImageSource imageSource = Utils.BitmapToImageSource(bitmap);
                            bitmap.Dispose();

                            prototype.AddIcon(imageSource);
                        }

                        Connection.Send(Connection.Socket, new Message(MessageTypes.REQUEST_NEXT_ICON, prototype.ID.ToString()));
                    }
                }
            }
        }