Exemplo n.º 1
0
        public DataOperationViewModel(IConnectorHolder connectorHolder)
        {
            _holder           = connectorHolder;
            EncryptionMethods = EncryptionMethod.GetSupportedMethods();
            SetDefaults();

            ClearCommand   = new RelayCommand(SetDefaults);
            RefreshCommand = new RelayCommandAsync(InitializeAsync, parameter => CanRefresh());
            SendCommand    = new RelayCommandAsync(SendDataOperationAsync, parameter => CanSend());
        }
        public MessagesViewModel(IConnectorHolder connectorHolder, IPasswordsHolder passwordsHolder)
        {
            _connectorHolder = connectorHolder;
            _passwordsHolder = passwordsHolder;

            EncryptionMethods = EncryptionMethod.GetSupportedMethods();
            SetDefaults();

            RefreshCommand = new RelayCommandAsync(InitializeAsync);
            SendCommand    = new RelayCommandAsync(SendDataOperationAsync, parameter => CanSend());

            _timer          = new DispatcherTimer();
            _timer.Tick    += new EventHandler(TimerTick);
            _timer.Interval = new TimeSpan(0, 0, Properties.Settings.Default.MessageRefreshingInterval);
            _timer.Start();
        }
Exemplo n.º 3
0
        public ChatRoomViewModel(IConnectorHolder connectorHolder, IPasswordsHolder passwordsHolder)
        {
            _connectorHolder = connectorHolder;
            _passwordsHolder = passwordsHolder;

            _chatRoomAccounts = !string.IsNullOrEmpty(Properties.Settings.Default.ChatRooms)
                ? new ObservableCollection <AccountInfo>(JsonSerializer.Deserialize <List <AccountInfo> >(Properties.Settings.Default.ChatRooms))
                : new ObservableCollection <AccountInfo>();

            EncryptionMethods = EncryptionMethod.GetSupportedMethods();
            SetDefaults();

            RefreshCommand = new RelayCommandAsync(InitializeAsync, parameter => !_isBusy);
            SendCommand    = new RelayCommandAsync(SendDataOperationAsync, parameter => CanSend());

            _timer          = new DispatcherTimer();
            _timer.Tick    += new EventHandler(TimerTick);
            _timer.Interval = new TimeSpan(0, 0, Properties.Settings.Default.MessageRefreshingInterval);
            _timer.Start();
        }