Example #1
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            InitConnection = new RelayCommand <bool>((standalone) =>
            {
                IsConnecting = true;

                Task.Factory.StartNew(() =>
                {
                    ServiceClientFactory.CloseAllConnection();

                    ServiceClientFactory.Standalone = standalone;

                    ServiceClientFactory.CreateConnection();

                    RaiseConnectionStateChange();
                }).ContinueWith(task =>
                {
                    IsConnecting = false;
                    App.Current.Dispatcher.Invoke(() => InitApplication());
                });
            }, (standalone) => !IsConnecting && !IsConnected);
        }