Пример #1
0
        private void GenerateDemoData()
        {
            DeployableInstances.Add(new InstanceVm()
            {
                CPUs        = 4,
                RAM         = 16,
                StorageSize = 1000,
                Type        = "VM"
            });

            DeployedInstances.Add(new InstanceVm()
            {
                CPUs        = 4,
                RAM         = 16,
                StorageSize = 1000,
                Type        = "VM",
                State       = StateType.OnHold
            });
        }
Пример #2
0
        private void UpdateGui(string data)
        {
            var seperated = data.Split('@'); // => String Array aus Split

            // here is the Problem!
            Console.WriteLine("Thread ID of TCP Thread: " + Dispatcher.CurrentDispatcher.Thread.ManagedThreadId);

            App.Current.Dispatcher.Invoke(() =>         // aus dem angegebene Thread ausführen => mit Current => Thread holen
            {
                Console.WriteLine("Thread of GUI: " + App.Current.Dispatcher.Thread.ManagedThreadId);

                DeployableInstances.Add(new InstanceVm()
                {
                    Type        = seperated[0],
                    RAM         = int.Parse(seperated[1]), // use tryParse instead!!!
                    CPUs        = int.Parse(seperated[2]),
                    StorageSize = int.Parse(seperated[3]),
                    State       = StateType.OnHold
                });
            });
        }