Пример #1
0
        /// <summary>
        /// コンストラクター(UnityMVC)
        /// </summary>
        /// <param name="sessionManager">セッションマネージャー</param>
        /// <param name="loginService">ログインサービス</param>
        public LoginController(ISessionManager sessionManager, IServiceProxy <ILoginService> loginService)
        {
            _SessionManager = sessionManager;
            _LoginService   = loginService;

            this._ControllerSupport = new ControllerSupport(this);
        }
        private static async Task ScheduleRequestImplementation(IBotService botService,
                                                                IServiceProxy serviceProxy, long chatId, RequestParams requestParams)
        {
            _logger.Info("Trying to send request to ProjectV service.");

            try
            {
                ProcessingResponse?response = await serviceProxy.SendPostRequest(requestParams);

                if (response is null)
                {
                    throw new InvalidOperationException("Request has not successful status.");
                }

                IReadOnlyDictionary <string, IList <double> > converted =
                    ConvertResultsToDict(response.RatingDataContainers);

                _logger.Info("Got response. Output message to Telegram chat.");

                await botService.Client.SendTextMessageAsync(
                    chatId,
                    CreateResponseMessage(converted)
                    );
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "Exception occurred during data processing request.");
                await botService.Client.SendTextMessageAsync(
                    chatId,
                    $"Cannot process request. Error: {ex.Message}"
                    );
            }

            _logger.Info("Request was processed.");
        }
        /// <summary>
        /// コンストラクター(UnityMVC)
        /// </summary>
        public DepartmentController(ISessionManager sessionManager, IServiceProxy <IDepartmentService> departmentService)
        {
            _SessionManager    = sessionManager;
            _DepartmentService = departmentService;

            this._ControllerSupport = new ControllerSupport(this);
        }
Пример #4
0
        public ServiceViewModel(IServiceProxy serviceProxy, IMetaPubSub metaMessenger)
        {
            _serviceProxy  = serviceProxy;
            _metaMessenger = metaMessenger;

            _metaMessenger.Subscribe <ConnectionServiceChangedMessage>(OnServiceConnectionStateChanged);
        }
Пример #5
0
        /// <summary>
        /// コンストラクター(UnityMVC)
        /// </summary>
        public AttendanceTimeController(ISessionManager sessionManager, IServiceProxy <IAttendanceTimeService> attendanceTimeService)
        {
            _SessionManager        = sessionManager;
            _AttendanceTimeService = attendanceTimeService;

            this._ControllerSupport = new ControllerSupport(this);
        }
Пример #6
0
 public MainProgram(IServiceProxy serviceproxy, IEmotionService emotionService, IMLService mlService)
 {
     _emotionService = emotionService;
     _mlService      = mlService;
     _endpointUri    = ConfigurationManager.AppSettings["endpointUri"].ToString();
     _primaryKey     = ConfigurationManager.AppSettings["primaryKey"].ToString();
 }
 public SemanticCheckerTests()
 {
     _logger          = Substitute.For <ILogger>();
     _metricServer    = Substitute.For <IMonitoringMetricServer>();
     _serviceProxy    = Substitute.For <IServiceProxy>();
     _semanticChecker = new SemanticChecker(_metricServer, _serviceProxy, _logger);
 }
        DeviceScopeIdentitiesCache(
            IServiceIdentityHierarchy serviceIdentityHierarchy,
            IServiceProxy serviceProxy,
            IKeyValueStore <string, string> encryptedStorage,
            IDictionary <string, StoredServiceIdentity> initialCache,
            TimeSpan periodicRefreshRate,
            TimeSpan refreshDelay)
        {
            this.serviceIdentityHierarchy  = serviceIdentityHierarchy;
            this.edgeDeviceId              = serviceIdentityHierarchy.GetActorDeviceId();
            this.serviceProxy              = serviceProxy;
            this.encryptedStore            = encryptedStorage;
            this.periodicRefreshRate       = periodicRefreshRate;
            this.refreshDelay              = refreshDelay;
            this.identitiesLastRefreshTime = new Dictionary <string, DateTime>();
            this.cacheLastRefreshTime      = DateTime.MinValue;

            // Populate the serviceIdentityHierarchy
            foreach (KeyValuePair <string, StoredServiceIdentity> kvp in initialCache)
            {
                kvp.Value.ServiceIdentity.ForEach(serviceIdentity => this.serviceIdentityHierarchy.InsertOrUpdate(serviceIdentity).Wait());
            }

            // Kick off the initial refresh after we processed all the stored identities
            this.refreshCacheTimer = new Timer(this.RefreshCache, null, TimeSpan.Zero, this.periodicRefreshRate);
        }
Пример #9
0
 internal RuntimeController(
     AppConfig appConfig,
     ILogger logger,
     IMessageBox messageBox,
     IOperationSequence bootstrapSequence,
     IRepeatableOperationSequence sessionSequence,
     IRuntimeHost runtimeHost,
     IRuntimeWindow runtimeWindow,
     IServiceProxy service,
     SessionContext sessionContext,
     Action shutdown,
     ISplashScreen splashScreen,
     IText text,
     IUserInterfaceFactory uiFactory)
 {
     this.appConfig         = appConfig;
     this.bootstrapSequence = bootstrapSequence;
     this.logger            = logger;
     this.messageBox        = messageBox;
     this.runtimeHost       = runtimeHost;
     this.runtimeWindow     = runtimeWindow;
     this.sessionSequence   = sessionSequence;
     this.service           = service;
     this.sessionContext    = sessionContext;
     this.shutdown          = shutdown;
     this.splashScreen      = splashScreen;
     this.text      = text;
     this.uiFactory = uiFactory;
 }
Пример #10
0
 /// <summary>
 /// 添加多个Client
 /// </summary>
 /// <param name="serviceProxy"></param>
 /// <param name="nodeClientList">NodeClient列表</param>
 public static IServiceProxy AddClients(this IServiceProxy serviceProxy, IList <INodeClient> nodeClientList)
 {
     foreach (var nodeClient in nodeClientList)
     {
         serviceProxy.AddClient(nodeClient);
     }
     return(serviceProxy);
 }
Пример #11
0
 private VideoService GetVideoService()
 {
     _pandaServiceProxy = MockRepository.GenerateStub<IServiceProxy>();
     _serializer = MockRepository.GenerateStub<IJsonSerializer>();
     var videoService = new VideoService(_pandaServiceProxy);
     videoService.JsonSerializer = _serializer;
     return videoService;
 }
Пример #12
0
        public ProxyMiddleware(RequestDelegate nextMiddleware, T serviceProxy, ILogger <ProxyMiddleware <T> > logger, IProxyHttpClientFactory clientFactory)
        {
            _nextMiddleware = nextMiddleware;
            _serviceProxy   = serviceProxy;
            _logger         = logger;

            _httpClient = clientFactory.Create(serviceProxy.DisableTlsVerification());
        }
Пример #13
0
 public AccountRecharge(ITradeRepository tradeRepository, ITradeRecordRepository tradeRecordRepository,
                        ITransaction transaction, IServiceProxy serviceProxy, IIocContainer iocContainer) : base(iocContainer)
 {
     this.tradeRepository       = tradeRepository;
     this.tradeRecordRepository = tradeRecordRepository;
     this.getUserState          = serviceProxy.CreateProxy <IGetUserState>();
     this.transaction           = transaction;
 }
Пример #14
0
 /// <summary>
 /// 将代理中的所有服务设置为禁用
 /// 注意:在调用此方法后添加的服务将不会被此方法的设置所影响
 /// </summary>
 /// <param name="serviceProxy"></param>
 /// <returns></returns>
 public static IServiceProxy DisableAll(this IServiceProxy serviceProxy)
 {
     foreach (var info in serviceProxy.ServiceProxyInfos)
     {
         info.Enabled = false;
     }
     return(serviceProxy);
 }
Пример #15
0
        public IndicatorsViewModel(IServiceProxy serviceProxy, IMetaPubSub metaMessenger)
        {
            _serviceProxy = serviceProxy;

            InitIndicators();

            metaMessenger.Subscribe <ConnectionServiceChangedMessage>(c => ResetIndicators(c.IsConnected));
            metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.ServiceComponentsStateChangedMessage>(OnComponentsStateChangedMessage);
        }
Пример #16
0
 public static Task <DeviceScopeIdentitiesCache> Create(
     IServiceIdentityHierarchy serviceIdentityHierarchy,
     IServiceProxy serviceProxy,
     IKeyValueStore <string, string> encryptedStorage,
     TimeSpan refreshRate,
     TimeSpan refreshDelay)
 {
     return(Create(serviceIdentityHierarchy, serviceProxy, encryptedStorage, refreshRate, refreshDelay, defaultInitializationRefreshDelay));
 }
Пример #17
0
        private VideoService GetVideoService()
        {
            _pandaServiceProxy = MockRepository.GenerateStub <IServiceProxy>();
            _serializer        = MockRepository.GenerateStub <IJsonSerializer>();
            var videoService = new VideoService(_pandaServiceProxy);

            videoService.JsonSerializer = _serializer;
            return(videoService);
        }
Пример #18
0
        /// <summary>
        /// Creates a ConversationMessagesViewModel
        /// </summary>
        /// <param name="phone"></param>
        public ConversationMessagesViewModel(
            IServiceProxy serviceProxy,
            IUserSettings userSettings,
            Guid conversationId,
            UserModel recipient,
            bool?isGroup)
        {
            this.serviceProxy               = serviceProxy;
            this.userSettings               = userSettings;
            this.messages                   = new ObservableSortedList <MessageModel>();
            this.conversationId             = conversationId;
            this.recipient                  = recipient;
            this.isGroup                    = isGroup;
            this.listOfQuestions            = new ObservableCollection <StringBuilder>();
            this.listOfAppointments         = new ObservableCollection <AppointmentDateTime>();
            this.listOfTaskItems            = new ObservableCollection <StringBuilder>();
            this.contactDetails.YapperName  = recipient.Name;
            this.contactDetails.YapperPhone = recipient.PhoneNumber;
            this.contactDetails.UserId      = recipient.Id;
            this.contactDetails.Search();

            if (this.IsGroup)
            {
                this.groupDetails.SetGroup(DataSync.Instance.GetGroup(this.recipient.Id));
            }

            string[] questions = new string[] { "Yes", "No", "Pass" };

            foreach (string s in questions)
            {
                this.listOfQuestions.Add(new StringBuilder(s));
            }

            AppointmentDateTime [] appts = new AppointmentDateTime[] { new AppointmentDateTime(DateTime.Now.Ticks), new AppointmentDateTime(DateTime.Now.Ticks), new AppointmentDateTime(DateTime.Now.Ticks) };

            foreach (AppointmentDateTime s in appts)
            {
                this.listOfAppointments.Add(s);
            }

            // Register the view to handle push notification when the app is running
            Messenger.Default.Register <NewMessageSavedEvent>(this, this.HandleNewMessageSavedEvent);
            Messenger.Default.Register <NewMessageEvent>(this, this.HandleNewMessageEvent);
            Messenger.Default.Register <ExistingMessageEvent>(this, this.HandleExistingMessageEvent);
            Messenger.Default.Register <DeleteEvent>(this, this.HandleDeleteEvent);

            lock (DataSync.Instance)
            {
                Messenger.Default.Register <SyncEvent>(this, this.HandleSyncCompleteEvent);

                DataSync.Instance.Sync();
                this.IsSyncing = !DataSync.Instance.IsSyncComplete;
            }

            this.IsCurrentyViewing = true;
        }
Пример #19
0
 DeviceScopeIdentitiesCache(IServiceProxy serviceProxy,
                            IKeyValueStore <string, string> encryptedStorage,
                            IDictionary <string, StoredServiceIdentity> initialCache,
                            TimeSpan refreshRate)
 {
     this.serviceProxy         = serviceProxy;
     this.encryptedStore       = encryptedStorage;
     this.serviceIdentityCache = initialCache;
     this.refreshRate          = refreshRate;
     this.refreshCacheTimer    = new Timer(this.RefreshCache, null, TimeSpan.Zero, refreshRate);
 }
Пример #20
0
 public ServiceOperation(
     ILogger logger,
     IRuntimeHost runtimeHost,
     IServiceProxy service,
     SessionContext sessionContext,
     int timeout_ms) : base(sessionContext)
 {
     this.logger      = logger;
     this.runtimeHost = runtimeHost;
     this.service     = service;
     this.timeout_ms  = timeout_ms;
 }
 public static void ScheduleRequest(IBotService botService, IServiceProxy serviceProxy,
                                    long chatId, RequestParams requestParams, CancellationToken token = default)
 {
     // Tricky code to send request in additional thread and transmit response to user.
     // Need to schedule task because our service should send response to Telegram.
     // Otherwise Telegram will retry to send event again untill service send a response.
     Task.Run(
         () => ScheduleRequestImplementation(botService, serviceProxy,
                                             chatId, requestParams),
         token
         );
 }
Пример #22
0
 public MLService(IServiceProxy serviceProxy)
 {
     _serviceProxy            = serviceProxy;
     _apiCognitiveEmotionLink = ConfigurationManager.AppSettings["ApiCognitiveEmotionLink"].ToString();
     _apiCognitiveFaceLink    = ConfigurationManager.AppSettings["ApiCognitiveFaceLink"].ToString();
     _apiCognitiveCVLink      = ConfigurationManager.AppSettings["ApiCognitiveCVLink"].ToString();
     _apiContentType          = ConfigurationManager.AppSettings["ApiContentType"].ToString();
     _apiKeyName     = ConfigurationManager.AppSettings["ApiKeyName"].ToString();
     _apiKeyEmotions = ConfigurationManager.AppSettings["ApiKeyEmotions"].ToString();
     _apiKeyFace     = ConfigurationManager.AppSettings["ApiKeyFace"].ToString();
     _apiKeyCV       = ConfigurationManager.AppSettings["ApiKeyCV"].ToString();
     _emotionMapper  = new MLMapper();
 }
Пример #23
0
 /// <summary>
 /// 根据类型名列表添加Service
 /// </summary>
 /// <param name="serviceProxy"></param>
 /// <param name="typeNameList"></param>
 /// <returns></returns>
 public static IServiceProxy AddServices(this IServiceProxy serviceProxy, IList <string> typeNameList)
 {
     foreach (var typeName in typeNameList)
     {
         var type = Type.GetType(typeName);
         if (!type.IsServiceProxy())
         {
             throw new InvalidOperationException($"{type.FullName} is not service proxy.");
         }
         serviceProxy.AddService(type);
     }
     return(serviceProxy);
 }
        public DeviceSettingsPageViewModel(IServiceProxy serviceProxy, IWindowsManager windowsManager, IActiveDevice activeDevice, IMetaPubSub metaMessenger)
        {
            this.serviceProxy   = serviceProxy;
            this.windowsManager = windowsManager;
            _metaMessenger      = metaMessenger;

            _metaMessenger.Subscribe <ActiveDeviceChangedMessage>(OnActiveDeviceChanged);

            Сonnected = new StateControlViewModel
            {
                Name    = "Status.Device.Сonnected",
                Visible = true,
            };
            Initialized = new StateControlViewModel
            {
                Name    = "Status.Device.Initialized",
                Visible = true,
            };
            Authorized = new StateControlViewModel
            {
                Name    = "Status.Device.Authorized",
                Visible = true,
            };
            StorageLoaded = new StateControlViewModel
            {
                Name    = "Status.Device.StorageLoaded",
                Visible = true,
            };

            Indicators.Add(Сonnected);
            Indicators.Add(Initialized);
            Indicators.Add(Authorized);
            Indicators.Add(StorageLoaded);

            this.WhenAnyValue(x => x.Device).Where(d => d != null).Subscribe(d =>
            {
                PropertyChangedEventManager.AddListener(Device, this, nameof(Device.IsConnected));
                PropertyChangedEventManager.AddListener(Device, this, nameof(Device.IsInitialized));
                PropertyChangedEventManager.AddListener(Device, this, nameof(Device.IsAuthorized));
                PropertyChangedEventManager.AddListener(Device, this, nameof(Device.IsStorageLoaded));

                Сonnected.State     = StateControlViewModel.BoolToState(Device.IsConnected);
                Initialized.State   = StateControlViewModel.BoolToState(Device.IsInitialized);
                Authorized.State    = StateControlViewModel.BoolToState(Device.IsAuthorized);
                StorageLoaded.State = StateControlViewModel.BoolToState(Device.IsStorageLoaded);
            });

            this.WhenAnyValue(x => x.LockProximity, x => x.UnlockProximity).Where(t => t.Item1 != 0 && t.Item2 != 0).Subscribe(o => ProximityHasChanges = true);

            Device = activeDevice.Device != null ? new DeviceViewModel(activeDevice.Device) : null;
        }
Пример #25
0
        public static async Task <DeviceScopeIdentitiesCache> Create(
            IServiceProxy serviceProxy,
            IKeyValueStore <string, string> encryptedStorage,
            TimeSpan refreshRate)
        {
            Preconditions.CheckNotNull(serviceProxy, nameof(serviceProxy));
            Preconditions.CheckNotNull(encryptedStorage, nameof(encryptedStorage));
            IDictionary <string, StoredServiceIdentity> cache = await ReadCacheFromStore(encryptedStorage);

            var deviceScopeIdentitiesCache = new DeviceScopeIdentitiesCache(serviceProxy, encryptedStorage, cache, refreshRate);

            Events.Created();
            return(deviceScopeIdentitiesCache);
        }
Пример #26
0
 public MenuFactory(IStartupHelper startupHelper
                    , IWindowsManager windowsManager, IAppHelper appHelper,
                    ISettingsManager <ApplicationSettings> settingsManager, ISupportMailContentGenerator supportMailContentGenerator,
                    IServiceProxy serviceProxy, IActiveDevice activeDevice, IMetaPubSub metaMessenger)
 {
     _startupHelper               = startupHelper;
     _windowsManager              = windowsManager;
     _appHelper                   = appHelper;
     _settingsManager             = settingsManager;
     _supportMailContentGenerator = supportMailContentGenerator;
     _serviceProxy                = serviceProxy;
     _activeDevice                = activeDevice;
     _metaMessenger               = metaMessenger;
 }
Пример #27
0
 static void SendMessage(IServiceProxy proxy, string message)
 {
     try
     {
         ss.SayHello(new HelloRequest()
         {
             Name = message
         });
     }
     catch (Exception ex)
     {
         Console.WriteLine($"异常   {ex.ToString()}");
     }
 }
Пример #28
0
        // Imports a range from workbook chosen by end-user. Assumes table starts at cell A1 on the first worksheet.
        public static void Import(IVisualCollection collection)
        {
            _collection = collection;

            Dispatchers.Main.BeginInvoke(() =>
            {
                OpenFileDialog dialog = new OpenFileDialog();
                dialog.Multiselect    = false;
                dialog.Filter         = "Excel Documents(*.xls;*.xlsx;*.csv)|*.xls;*.xlsx;*.csv|All files (*.*)|*.*";
                if (dialog.ShowDialog() == true)
                {
                    FileInfo f = dialog.File;
                    try
                    {
                        ExcelHelper excel = new ExcelHelper();
                        excel.OpenWorkbook(f.FullName);
                        _excelDocRange = excel.UsedRange(1, 1);
                        excel.Dispose();

                        List <FieldDefinition> tablePropertyChoices = GetTablePropertyChoices();

                        _columnMappings  = new List <ColumnMapping>();
                        Int32 numColumns = _excelDocRange.GetLength(1);
                        for (var i = 0; i <= numColumns - 1; i++)
                        {
                            _columnMappings.Add(new ColumnMapping(_excelDocRange[0, i], tablePropertyChoices));
                        }

                        ColumnMapper columnMapperContent      = new ColumnMapper();
                        columnMapperContent.OfficeColumn.Text = "Excel Column";
                        ScreenChildWindow columnMapperWindow  = new ScreenChildWindow();
                        columnMapperContent.DataContext       = _columnMappings;
                        columnMapperWindow.Closed            += OnMappingDialogClosed;

                        //set parent to current screen
                        IServiceProxy sdkProxy   = VsExportProviderService.GetExportedValue <IServiceProxy>();
                        columnMapperWindow.Owner = (Control)sdkProxy.ScreenViewService.GetScreenView(_collection.Screen).RootUI;
                        columnMapperWindow.Show(_collection.Screen, columnMapperContent);
                    }
                    catch (SecurityException ex)
                    {
                        collection.Screen.Details.Dispatcher.BeginInvoke(() => { _collection.Screen.ShowMessageBox("Error: Silverlight Security error. Could not load Excel document. Make sure the document is in your 'Documents' directory."); });
                    }
                    catch (COMException comEx)
                    {
                        _collection.Screen.Details.Dispatcher.BeginInvoke(() => { _collection.Screen.ShowMessageBox("Error: Could not open this file.  It may not be a valid Excel document."); });
                    }
                }
            });
        }
Пример #29
0
        // Imports a range starting at the location specified by workbook, worksheet, and range.
        // Workbook should be the full path to the workbook.
        public static void Import(IVisualCollection collection, string Workbook, string Worksheet, string Range)
        {
            _collection = collection;

            Dispatchers.Main.BeginInvoke(() =>
            {
                ExcelHelper xlProxy = new ExcelHelper();
                dynamic wb          = null;
                dynamic ws          = null;
                dynamic rg          = null;

                wb = xlProxy.Excel.Workbooks.Open(Workbook);
                if ((wb != null))
                {
                    ws = wb.Worksheets(Worksheet);
                    if ((ws != null))
                    {
                        rg             = ws.Range(Range);
                        _excelDocRange = ConvertToArray(rg);

                        List <FieldDefinition> tablePropertyChoices = GetTablePropertyChoices();

                        _columnMappings  = new List <ColumnMapping>();
                        Int32 numColumns = _excelDocRange.GetLength(1);
                        for (var i = 0; i <= numColumns - 1; i++)
                        {
                            _columnMappings.Add(new ColumnMapping(_excelDocRange[0, i], tablePropertyChoices));
                        }

                        ColumnMapper columnMapperContent      = new ColumnMapper();
                        columnMapperContent.OfficeColumn.Text = "Excel Column";
                        ScreenChildWindow columnMapperWindow  = new ScreenChildWindow();
                        columnMapperContent.DataContext       = _columnMappings;
                        columnMapperWindow.Closed            += OnMappingDialogClosed;

                        //set parent to current screen
                        IServiceProxy sdkProxy   = VsExportProviderService.GetExportedValue <IServiceProxy>();
                        columnMapperWindow.Owner = (Control)sdkProxy.ScreenViewService.GetScreenView(_collection.Screen).RootUI;
                        columnMapperWindow.Show(_collection.Screen, columnMapperContent);
                    }
                }

                rg = null;
                ws = null;
                wb.Close(false);
                wb = null;
                xlProxy.Dispose();
            });
        }
Пример #30
0
        private static void DisplayErrors(List <string> errorList)
        {
            Dispatchers.Main.BeginInvoke(() =>
            {
                //Display some sort of dialog indicating that errors occurred
                IServiceProxy sdkProxy        = VsExportProviderService.GetExportedValue <IServiceProxy>();
                ErrorList errorDialog         = new ErrorList();
                ScreenChildWindow errorWindow = new ScreenChildWindow();
                errorDialog.DataContext       = errorList;
                errorWindow.DataContext       = errorList;
                errorWindow.Owner             = (Control)sdkProxy.ScreenViewService.GetScreenView(_collection.Screen).RootUI;

                errorWindow.Closed += OnErroDialogClosed;
                errorWindow.Show(_collection.Screen, errorDialog);
            });
        }
Пример #31
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="serviceProxy"></param>
        /// <param name="dataContext"></param>
        /// <param name="contactSearchController"></param>
        public RegisteredUsersViewModel(IServiceProxy serviceProxy, IUserSettings userSettings, IContactSearchController contactSearchController)
        {
            this.serviceProxy            = serviceProxy;
            this.contactSearchController = contactSearchController;

            lock (DataSync.Instance)
            {
                if (!DataSync.Instance.IsSyncComplete)
                {
                    Messenger.Default.Register <SyncEvent>(this, this.ReadRegisteredUsersFromDB);
                }

                this.isLoading = !DataSync.Instance.IsUsersSyncComplete;
            }

            this.RegisteredUsers = new ObservableSortedList <ContactGroup <UserModel> >();
            this.ReadRegisteredUsersFromDB();
        }
Пример #32
0
 // additional constructors created to support unit testing
 public VideoService(IServiceProxy _serviceProxy)
 {
     _proxy = _serviceProxy;
     WireDebuggingEvents();
 }
Пример #33
0
 public VideoService(string cloudId, string accessKey, string secretKey, string apiHost, int apiPort, int apiVersion)
 {
     _proxy = new ServiceProxy(cloudId, accessKey, secretKey, apiHost, apiPort, apiVersion);
     WireDebuggingEvents();
 }
Пример #34
0
 /// <summary>
 /// Creates an instance of NewUserRegistrationViewModel
 /// </summary>
 /// <param name="serviceProxy"></param>
 public NewUserRegistrationViewModel(IServiceProxy serviceProxy)
 {
     this.serviceProxy = serviceProxy;
 }
Пример #35
0
        /// <summary>
        /// Constructor to create the AllConversationsViewModel instance
        /// </summary>
        /// <param name="phone"></param>
        public AllConversationsViewModel(
            IServiceProxy serviceProxy,
            IUserSettings userSettings)
        {
            this.serviceProxy = serviceProxy;
            this.userSettings = userSettings;
            Messenger.Default.Register<NewMessageSavedEvent>(this, this.HandleNewMessageSavedEvent);
            Messenger.Default.Register<NewMessageEvent>(this, this.HandleNewMessageSentEvent);
            Messenger.Default.Register<DeleteEvent>(this, this.HandleDeleteEvent);
            lock (DataSync.Instance)
            {
                Messenger.Default.Register<SyncEvent>(this, this.HandleSyncCompleteEvent);
                DataSync.Instance.Sync();
            }

            this.initialLoadCompleted = DataSync.Instance.IsSyncComplete;
            this.ReadConversationFromLocalDB();
        }
Пример #36
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="serviceProxy"></param>
        /// <param name="dataContext"></param>
        /// <param name="contactSearchController"></param>
        public RegisteredUsersViewModel(IServiceProxy serviceProxy, IUserSettings userSettings, IContactSearchController contactSearchController)
        {
            this.serviceProxy = serviceProxy;
            this.contactSearchController = contactSearchController;

            lock (DataSync.Instance)
            {
                if (!DataSync.Instance.IsSyncComplete)
                {
                    Messenger.Default.Register<SyncEvent>(this, this.ReadRegisteredUsersFromDB);
                }

                this.isLoading = !DataSync.Instance.IsUsersSyncComplete;
            }

            this.RegisteredUsers = new ObservableSortedList<ContactGroup<UserModel>>();
            this.ReadRegisteredUsersFromDB();
        }
Пример #37
0
        /// <summary>
        /// Creates a ConversationMessagesViewModel
        /// </summary>
        /// <param name="phone"></param>
        public ConversationMessagesViewModel(
            IServiceProxy serviceProxy,
            IUserSettings userSettings,
            Guid conversationId,
            UserModel recipient,
            bool? isGroup)
        {
            this.serviceProxy = serviceProxy;
            this.userSettings = userSettings;
            this.messages = new ObservableSortedList<MessageModel>();
            this.conversationId = conversationId;
            this.recipient = recipient;
            this.isGroup = isGroup;
            this.listOfQuestions = new ObservableCollection<StringBuilder>();
            this.listOfAppointments = new ObservableCollection<AppointmentDateTime>();
            this.listOfTaskItems = new ObservableCollection<StringBuilder>();
            this.contactDetails.YapperName = recipient.Name;
            this.contactDetails.YapperPhone = recipient.PhoneNumber;
            this.contactDetails.UserId = recipient.Id;
            this.contactDetails.Search();

            if (this.IsGroup)
            {
                this.groupDetails.SetGroup(DataSync.Instance.GetGroup(this.recipient.Id));
            }

            string[] questions = new string[] { "Yes", "No", "Pass" };

            foreach (string s in questions)
            {
                this.listOfQuestions.Add(new StringBuilder(s));
            }

            AppointmentDateTime [] appts = new AppointmentDateTime[] { new AppointmentDateTime(DateTime.Now.Ticks), new AppointmentDateTime(DateTime.Now.Ticks), new AppointmentDateTime(DateTime.Now.Ticks) };

            foreach (AppointmentDateTime s in appts)
            {
                this.listOfAppointments.Add(s);
            }

            // Register the view to handle push notification when the app is running
            Messenger.Default.Register<NewMessageSavedEvent>(this, this.HandleNewMessageSavedEvent);
            Messenger.Default.Register<NewMessageEvent>(this, this.HandleNewMessageEvent);
            Messenger.Default.Register<ExistingMessageEvent>(this, this.HandleExistingMessageEvent);
            Messenger.Default.Register<DeleteEvent>(this, this.HandleDeleteEvent);

            lock (DataSync.Instance)
            {
                Messenger.Default.Register<SyncEvent>(this, this.HandleSyncCompleteEvent);

                DataSync.Instance.Sync();
                this.IsSyncing = !DataSync.Instance.IsSyncComplete;
            }

            this.IsCurrentyViewing = true;
        }