Пример #1
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            try
            {
                random              = new Random();
                _sync               = new object();
                _client             = SimpleIoc.Default.GetInstance <IClient>();
                _settingsRepository = SimpleIoc.Default.GetInstance <ISettingsRepository>();

                apiExt = _client.GetAPIExtension(null);

                CallCommand = new RelayCommand <string>(CallPressed,
                                                        phoneNumber => !string.IsNullOrEmpty(UsedPhoneNumber) && !string.IsNullOrEmpty(phoneNumber));

                _internalPhoneBookItems = new List <PhoneBookItem>();
                PhoneBookItems          = CollectionViewSource.GetDefaultView(_internalPhoneBookItems);

                _client.PhoneBookChanged += OnPhoneBookChanged;
                _client.SessionCreated   += ClientOnSessionCreated;
                _client.ErrorOccurred    += ClientOnErrorOccurred;
                _client.GetPhoneBook();
            }
            catch (Exception ex)
            {
            }
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            try
            {
                random = new Random();
                _sync = new object();
                _client = SimpleIoc.Default.GetInstance<IClient>();
                _settingsRepository = SimpleIoc.Default.GetInstance<ISettingsRepository>();

                apiExt = _client.GetAPIExtension(null);

                CallCommand = new RelayCommand<string>(CallPressed,
                                                       phoneNumber => !string.IsNullOrEmpty(UsedPhoneNumber) && !string.IsNullOrEmpty(phoneNumber));

                _internalPhoneBookItems = new List<PhoneBookItem>();
                PhoneBookItems = CollectionViewSource.GetDefaultView(_internalPhoneBookItems);

                _client.PhoneBookChanged += OnPhoneBookChanged;
                _client.SessionCreated += ClientOnSessionCreated;
                _client.ErrorOccurred += ClientOnErrorOccurred;
                _client.GetPhoneBook();
            }
            catch (Exception ex)
            {

            }
        }