public AuthenticationController(ICryptographer cryptographer, IPersistenceSession session, IAuth auth, IMessagingService messaging)
 {
     crypto = cryptographer;
     this.session = session;
     this.auth = auth;
     this.messaging = messaging;
 }
 public void Setup()
 {
     _systemClock = MockRepository.GenerateStub<ISystemClock>();
     _logger = MockRepository.GenerateMock<ILogger>(); //a Mock, because it's key to the test assertions
     _messagingService = new MessagingService(_logger);
     _supportCase = new SupportCase("Interacting with the logger", _systemClock);
 }
Example #3
0
 public TaskViewModel(Task model, IDiagram widget, IMessagingService messagingService)
 {
     _widget = widget;
     _messagingService = messagingService;
     Model = model;
     ToggleCompletedCommand = new CaptionCommand<string>("ยจ", OnToggleCompleted);
 }
 public void Setup()
 {
     _systemClock = MockRepository.GenerateStub<ISystemClock>();
     _logger = new MockLogger();
     _messagingService = new MessagingService(_logger);
     _supportCase = new SupportCase("Looking at the logs", _systemClock);
 }
        public ChatViewModel(IMessagingService messagingService)
        {
            _messagingService = messagingService;

            ConnectCommand = new DelegateCommand(OnConnect);
            SendCommand = new DelegateCommand(OnSendMessage);
        }
Example #6
0
 public bool Start(HostControl hostControl)
 {
     _bus = IoCContext.Current.Container.Resolve<IMessagingService>("WorkflowMessaging");
     IDictionary<string, string> settings = new Dictionary<string, string>();
     settings.Add("EndpointName", "PocketBoss_Local_Service");
     _bus.OpenConnection(settings);
     return true;
 }
        public BooksViewModel(IBooksService booksService, IMessagingService messagingService)
        {
            _booksService = booksService;
            _messagingService = messagingService;
            NewBookCommand = new DelegateCommand(OnNewBook);

            EventAggregator<InitBookEvent>.Instance.Event += OnInitBook;
        }
        public GroupChatViewModel(IMessagingService messagingService)
        {
            _messagingService = messagingService;

            ConnectCommand = new DelegateCommand(OnConnect);
            SendCommand = new DelegateCommand(OnSendMessage);
            EnterGroupCommand = new DelegateCommand(OnEnterGroup);
            LeaveGroupCommand = new DelegateCommand(OnLeaveGroup);
        }
Example #9
0
 public TaskViewModel(Task model, TaskType taskType, TaskEditorViewModel widget, IMessagingService messagingService)
 {
     _taskType = taskType;
     _widget = widget;
     _messagingService = messagingService;
     Model = model;
     ToggleCompletedCommand = new CaptionCommand<string>("ยจ", OnToggleCompleted);
     ExecuteCommand = new DelegateCommand<string>(OnCommandExecute);
 }
Example #10
0
 public SettingsViewModel(ISettingService settingService, IMessagingService messagingService)
 {
     _settingService = settingService;
     _messagingService = messagingService;
     SaveSettingsCommand = new CaptionCommand<string>(Resources.Save, OnSaveSettings);
     StartMessagingServerCommand = new CaptionCommand<string>(Resources.StartClientNow, OnStartMessagingServer, CanStartMessagingServer);
     DisplayCommonAppPathCommand = new CaptionCommand<string>(Resources.DisplayAppPath, OnDisplayAppPath);
     DisplayUserAppPathCommand = new CaptionCommand<string>(Resources.DisplayUserPath, OnDisplayUserPath);
 }
Example #11
0
 public TaskEditorViewModel(Widget widget, IApplicationState applicationState, ITaskService taskService,
     ICacheService cacheService, IMessagingService messagingService)
     : base(widget, applicationState)
 {
     _taskService = taskService;
     _cacheService = cacheService;
     _messagingService = messagingService;
     Tasks = new ObservableCollection<TaskViewModel>();
     AddTaskCommand = new CaptionCommand<string>(Resources.Add, OnAddTask);
 }
        public void Setup()
        {
            MyCredentials = new Credentials() { UserName = "******", Password = "******" };
            ServiceProvider = new ServiceProvider(new PluginFinder());
            ServiceProvider.Add(new FauxMessageService("test 1"), new FauxMessageService("test2"));
            ServiceManager = new ServicesManager(ServiceProvider);

            Context();
            Because();
        }
Example #13
0
 public CampaignController(ICampaignService campaignService, IMessagingService messagingService, ICalendarService calendarService, 
     IProductRepository productRepository, IConfigurationService configurationService, ICanSave saver)
 {
     this.campaignService = campaignService;
     this.messagingService = messagingService;
     this.calendarService = calendarService;
     this.productRepository = productRepository;
     this.configurationService = configurationService;
     this.saver = saver;
 }
Example #14
0
 /// <summary>
 /// Initialises an instance of <see cref="LoginViewModel"/>.
 /// </summary>
 /// <param name="userRepository">An implemetation of <see cref="IUserRepository"/>. </param>
 /// <param name="messagingService"></param>
 public LoginViewModel(IUserRepository userRepository, IMessagingService messagingService)
     : base("Login")
 {
     if (userRepository == null)
         throw new ArgumentNullException("userRepository");
     if (messagingService == null)
         throw new ArgumentNullException("messagingService");
     _userRepository = userRepository;
     _messagingService = messagingService;
     TryLogInCommand = new RelayCommand(TryLoginIn, CanTryLogin);
 }
        public void Setup()
        {
            FakeMessagingPlugin = new GetCredentialsPlugIn();

            FakeRepo = new ScenarioRepository()
                           {
                               FakeMessagePlugin = FakeMessagingPlugin
                           };

            Context();
            Because();
        }
Example #16
0
 /// <summary>
 /// Intializes an instance of <see cref="UserViewModel"/>.
 /// </summary>
 /// <param name="user"></param>
 /// <param name="messagingService"> </param>
 public UserViewModel(User user, IMessagingService messagingService)
 {
     if (user == null)
         throw new ArgumentNullException("user");
     if (messagingService == null)
         throw new ArgumentNullException("messagingService");
     _messagingService = messagingService;
     Entity = user;
     //IsUsernameEditable=Entity.UserId <1;
     //Initialize commands
     ChangeImageCommand = new RelayCommand(ChangeImage);
 }
        public MessageClientStatusView(IMessagingService messagingService)
        {
            _messagingService = messagingService;
            InitializeComponent();
            Application.Current.MainWindow.Closing += MainWindow_Closing;

            _timer = new Timer(OnTimerTick, null, Timeout.Infinite, 1000);
            if (LocalSettings.StartMessagingClient)
            {
                _timer.Change(10000, 10000);
            }
            else StatusLabel.Visibility = System.Windows.Visibility.Collapsed;
        }
Example #18
0
 /// <summary>
 /// Initializes an instance of <see cref="TransactionFilterViewModel"/>.
 /// </summary>
 /// <param name="isUserAdmin"></param>
 /// <param name="userRepository"></param>
 /// <param name="messagingService"></param>
 public TransactionFilterViewModel(bool isUserAdmin, IUserRepository userRepository, IMessagingService messagingService)
 {
     if (userRepository == null)
         throw new ArgumentNullException("userRepository");
     if (messagingService == null)
         throw new ArgumentNullException("messagingService");
     _userRepository = userRepository;
     _messagingService = messagingService;
     IsUserAdmin = isUserAdmin;
     ResetDates();
     ApplyFilterCommand = new RelayCommand(ApplyFilter, CanApplyFilter);
     AllUsers = new ExtendedObservableCollection<string>(false);
 }
Example #19
0
 /// <summary>
 /// Gets a singleton instance of <see cref="IMessagingService"/>.
 /// </summary>
 /// <returns></returns>
 public static IMessagingService GetMessagingServiceInstance()
 {
     if (null == _messagingServiceInstance)
     {
         lock (_syncObject)
         {
             if (null == _messagingServiceInstance)
             {
                 _messagingServiceInstance = new MessagingService();
             }
         }
     }
     return _messagingServiceInstance;
 }
Example #20
0
 /// <summary>
 /// Initializes an instance of <see cref="HomeViewModel"/>.
 /// </summary>
 /// <param name="viewList">The enumerable of all other view than the home view.</param>
 /// <param name="messagingService">An implementation of <see cref="IMessagingService"/>.</param>
 public HomeViewModel(IEnumerable<WorkspaceViewModelBase> viewList, string registeredName, IMessagingService messagingService)
     : base(registeredName)
 {
     if (null == viewList)
         throw new ArgumentNullException("viewList");
     if (messagingService == null)
         throw new ArgumentNullException("messagingService");
     _messagingService = messagingService;
     DisplayName = UIText.HOME_VIEW_HEADER;
     CanGoBack = false;
     AllViews = new ObservableCollection<WorkspaceViewModelBase>(viewList);
     //Command Initialization
     GoToCommand = new RelayCommand<string>(GoToView);
 }
Example #21
0
 /// <summary>
 /// Initializes an instance of <see cref="SettingsViewModel"/>.
 /// </summary>
 /// <param name="messagingService">An implementation of <see cref="IMessagingService"/>.</param>
 /// <param name="userRepository"> </param>
 public SettingsViewModel(IMessagingService messagingService, IUserRepository userRepository)
 {
     if (null == messagingService)
         throw new ArgumentNullException("messagingService");
     if (userRepository == null)
         throw new ArgumentNullException("userRepository");
     _messagingService = messagingService;
     _userRepository = userRepository;
     AccentColorlist = new List<string>(AppearanceManager.GetAccentNames());
     ThemeColorlist = new List<string>(AppearanceManager.GetThemeNames());
     _selectedAccent = AppearanceManager.GetApplicationAccent();
     _selectedTheme = AppearanceManager.GetApplicationTheme();
     //Initialize commands
     ChangePasswordCommand = new RelayCommand(ChangePassword, CanChangePassword);
 }
Example #22
0
 internal static void PublishWorkflowState(IMessagingService bus, WorkflowInstance newWorkflow, string auditContext)
 {
     bus.Publish<WorkflowStateNotification>(new WorkflowStateNotification()
     {
         AuditContext = auditContext,
         CorrelationId = Guid.NewGuid(),
         IsComplete = newWorkflow.CurrentState.StateTemplate.LastState,
         State = newWorkflow.CurrentState.StateTemplate.StateName,
         StateId = newWorkflow.CurrentState.Id,
         TargetObjectId = newWorkflow.TargetObjectId,
         TargetObjectType = newWorkflow.TargetObjectType,
         TenantId = newWorkflow.TenantId,
         WorkflowInstanceId = newWorkflow.Id,
         WorkflowTemplateName = newWorkflow.WorkflowTemplate.WorkflowName,
     });
 }
Example #23
0
 /// <summary>
 /// Initializes an instance of <see cref="ManageViewModel"/>.
 /// </summary>
 /// <param name="registeredName"></param>
 /// <param name="userRepository"></param>
 /// <param name="messagingService"></param>
 /// <param name="canUserNavigate"></param>
 public ManageViewModel(string registeredName, IUserRepository userRepository, IMessagingService messagingService,bool canUserNavigate)
     : base(registeredName,canUserNavigate)
 {
     if (userRepository == null)
         throw new ArgumentNullException("userRepository");
     if (messagingService == null)
         throw new ArgumentNullException("messagingService");
     _userRepository = userRepository;
     _messagingService = messagingService;
     DisplayName = UIText.MANAGE_VIEW_HEADER;
     CanGoBack = true;
     Users = new ExtendedObservableCollection<UserViewModel>();
     //Intialize commands
     RefreshUserListCommand = new RelayCommand(RefreshUserList);
     SaveUsersCommand = new RelayCommand(SaveUser, CanSaveUser);
     AddNewUserCommand = new RelayCommand(() => SelectedUser = new UserViewModel(_userRepository.GetNewUser(),_messagingService));
 }
Example #24
0
        public PosViewModel(IRegionManager regionManager, IApplicationState applicationState, IApplicationStateSetter applicationStateSetter,
            ITicketService ticketService, ITicketServiceBase ticketServiceBase, IUserService userService, ICacheService cacheService, IMessagingService messagingService,
            TicketListViewModel ticketListViewModel, TicketTagListViewModel ticketTagListViewModel, MenuItemSelectorViewModel menuItemSelectorViewModel,
            MenuItemSelectorView menuItemSelectorView, TicketViewModel ticketViewModel, TicketOrdersViewModel ticketOrdersViewModel,
            TicketEntityListViewModel ticketEntityListViewModel, TicketTypeListViewModel ticketTypeListViewModel, AccountBalances accountBalances)
        {
            _ticketService = ticketService;
            _ticketServiceBase = ticketServiceBase;
            _userService = userService;
            _cacheService = cacheService;
            _messagingService = messagingService;
            _applicationState = applicationState;
            _applicationStateSetter = applicationStateSetter;
            _regionManager = regionManager;
            _menuItemSelectorView = menuItemSelectorView;
            _ticketViewModel = ticketViewModel;
            _ticketOrdersViewModel = ticketOrdersViewModel;
            _menuItemSelectorViewModel = menuItemSelectorViewModel;
            _ticketListViewModel = ticketListViewModel;
            _ticketTagListViewModel = ticketTagListViewModel;
            _ticketEntityListViewModel = ticketEntityListViewModel;
            _ticketTypeListViewModel = ticketTypeListViewModel;
            _accountBalances = accountBalances;

            EventServiceFactory.EventService.GetEvent<GenericEvent<Order>>().Subscribe(OnOrderEventReceived);
            EventServiceFactory.EventService.GetEvent<GenericEvent<Ticket>>().Subscribe(OnTicketEventReceived);
            EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(OnTicketEvent);
            EventServiceFactory.EventService.GetEvent<GenericEvent<ScreenMenuItemData>>().Subscribe(OnMenuItemSelected);
            EventServiceFactory.EventService.GetEvent<GenericIdEvent>().Subscribe(OnTicketIdPublished);
            EventServiceFactory.EventService.GetEvent<GenericEvent<OperationRequest<Entity>>>().Subscribe(OnEntitySelectedForTicket);
            EventServiceFactory.EventService.GetEvent<GenericEvent<TicketTagGroup>>().Subscribe(OnTicketTagSelected);
            EventServiceFactory.EventService.GetEvent<GenericEvent<TicketStateData>>().Subscribe(OnTicketStateSelected);
            EventServiceFactory.EventService.GetEvent<GenericEvent<TicketType>>().Subscribe(OnTicketTypeChanged);

            EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(
            x =>
            {
                if (x.Topic == EventTopicNames.ResetCache && _applicationState.CurrentTicketType != null)
                {
                    _menuItemSelectorViewModel.Reset();
                    _menuItemSelectorViewModel.UpdateCurrentScreenMenu(_applicationState.CurrentTicketType.GetScreenMenuId(_applicationState.CurrentTerminal));
                }
            });
        }
Example #25
0
 /// <summary>
 /// Initializes an instance of <see cref="ApplicationViewModel"/>.
 /// </summary>
 /// <param name="user">The view model that wraps the logged in user model. </param>
 /// <param name="transactionRepository">An instance of <see cref="ITransactionRepository"/> implementation.</param>
 /// <param name="userRepository"> >An instance of <see cref="IUserRepository"/> implementation.</param>
 /// <param name="messagingService">An implementation of <see cref="IMessagingService"/> </param>
 public ApplicationViewModel(UserViewModel user,ITransactionRepository transactionRepository, IUserRepository userRepository, IMessagingService messagingService)
     : base("ApplicationViewModel")
 {
     LoggedInUser = user;
     bool isUserAdmin = user.Role == UserRole.Admin;
     //Configure the navigator
     Navigator = NavigatorFactory.GetNavigator();
     var viewList = new List<WorkspaceViewModelBase>()
                        {
                            new AllTransactionViewModel(isUserAdmin,Constants.ALLEXPENSES_VIEW_REGERED_NAME,userRepository,transactionRepository,messagingService),
                            new ManageViewModel(Constants.MANAGE_VIEW_REGERED_NAME,userRepository,messagingService,isUserAdmin)
                        };
     viewList.ForEach(wvm => Navigator.AddView(wvm));
     Navigator.AddHomeView(new HomeViewModel(viewList, Constants.HOME_VIEW_REGERED_NAME, messagingService));
     Navigator.PropertyChanged += NavigatorPropertyChanged;
     Navigator.NavigateToHome();
     //Initialie the commands
     NavigateBackCommand = new RelayCommand(Navigator.NavigateBack);
 }
Example #26
0
 public static void BootstrapStructureMap(
     IInteractionContext gui, 
     IPluginFinder pluginFinder, 
     ISettingsProvider settings, 
     IMessagingService plugin)
 {
     // Initialize the static ObjectFactory container
     ObjectFactory.Initialize(x =>
     {
         x.ForRequestedType<MainView>().TheDefaultIsConcreteType<MainView>();
         x.ForRequestedType<IInteractionContext>().TheDefault.IsThis(gui);
         x.ForRequestedType<IMessagingService>().TheDefault.IsThis(plugin);
         x.ForRequestedType<ISettingsProvider>().TheDefault.IsThis(settings);
         x.ForRequestedType<IMessagingServiceManager>().TheDefaultIsConcreteType<ServicesManager>();
         x.ForRequestedType<IContactProvider>().TheDefaultIsConcreteType<ContactProvider>();
         x.ForRequestedType<IServiceProvider>().TheDefaultIsConcreteType<ServiceProvider>();
         x.ForRequestedType<IPluginFinder>().TheDefault.IsThis(pluginFinder);
     });
 }
Example #27
0
 /// <summary>
 /// Initializes an instance of <see cref="MainWindowViewModel"/>.
 /// </summary>
 /// <param name="messagingService"></param>
 public MainWindowViewModel(IMessagingService messagingService)
 {
     if (null == messagingService)
         throw new ArgumentNullException("messagingService");
     _messagingService = messagingService;
     _loginView = new LoginViewModel(RepositoryFactory.GetUserRepository(), _messagingService);
     SelectedView = _loginView;
     SettingsView = new SettingsViewModel(_messagingService, RepositoryFactory.GetUserRepository())
                        {
                            Position = VisibilityPosition.Right,
                            Theme = FlyoutTheme.AccentedTheme,
                            Header = UIText.SETTINGS_VIEW_HEADER
                        };
     IsUserLoggedIn = false;
     //Initialize commands
     ToggleSettingsVisibilityCommand = new RelayCommand(() => SettingsView.IsOpen = !SettingsView.IsOpen, () => IsUserLoggedIn);
     ShowHelpCommand = new RelayCommand(ShowHelp);
     //SessionProvider.RebuildSchema();
 }
Example #28
0
 /// <summary>
 /// Initializes an instance of <see cref="AllTransactionViewModel"/>.
 /// </summary>
 /// <param name="isUserAdmin">Gets if the logged in user is admin </param>
 /// <param name="registeredName">Registered name of this instance of <see cref="WorkspaceViewModelBase"/>.</param>
 /// <param name="userRepository"> </param>
 /// <param name="transactionRepository">An instance of transaction repository contract.</param>
 /// <param name="messagingService">An implementation of <see cref="IMessagingService"/>. </param>
 public AllTransactionViewModel(bool isUserAdmin, string registeredName, IUserRepository userRepository, ITransactionRepository transactionRepository, IMessagingService messagingService)
     : base(registeredName)
 {
     if (userRepository == null)
         throw new ArgumentNullException("userRepository");
     if (transactionRepository == null)
         throw new ArgumentNullException("transactionRepository");
     if (messagingService == null)
         throw new ArgumentNullException("messagingService");
     DisplayName = UIText.EXPENSE_VIEW_HEADER;
     _userRepository = userRepository;
     IsUserAdmin = isUserAdmin;
     _transactionRepository = transactionRepository;
     _messagingService = messagingService;
     CanGoBack = true;
     //Initialize commands
     AddNewTransactionCommand = new RelayCommand(() => SelectedTransaction = new TransactionViewModel(_transactionRepository.GetNewTransaction()));
     SaveTransactionCommand = new RelayCommand(SaveTransaction, CanSaveTransaction);
     DeleteTransactionsCommand = new RelayCommand(DeleteTransactions);
 }
Example #29
0
 internal static void PublishNewTasks(IMessagingService bus, WorkflowInstance newWorkflow, string auditContext)
 {
     newWorkflow.CurrentState.CurrentTasks.ForEach(x =>
     {
         bus.Publish<WorkflowTaskNotification>(new WorkflowTaskNotification()
         {
             AuditContext = auditContext,
             CorrelationId = Guid.NewGuid(),
             State = newWorkflow.CurrentState.StateTemplate.StateName,
             TargetObjectId = newWorkflow.TargetObjectId,
             TargetObjectType = newWorkflow.TargetObjectType,
             TenantId = newWorkflow.TenantId,
             WorkflowInstanceId = newWorkflow.Id,
             WorkflowTemplateName = newWorkflow.WorkflowTemplate.WorkflowName,
             StateId = newWorkflow.CurrentState.Id,
             TaskId = x.Id,
             Task = x.TaskTemplate.TaskName.Replace(newWorkflow.CurrentState.StateTemplate.StateName + "|",""),
             IsComplete = x.LastTask,
         });
     });
 }
Example #30
0
        public void Context()
        {
            container.GetMock<IAgencyService>()
                .Expect(a => a.CurrentAgency)
                .Returns(new AgencyBuilder().WithEmail(AGENCY_EMAIL).Build());
            container.GetMock<IAgencyService>()
                .Expect(a => a.GetAgencyRootUrl(It.IsAny<string>()))
                .Returns("");
            container.GetMock<ITemplateService>()
                .Expect(ts => ts.Render(It.IsAny<string>(), It.IsAny<Dictionary<string, object>>()));
            container.GetMock<IConfigurationService>()
                .Expect(cs => cs.SiteRootUrl)
                .Returns(String.Empty);
            container.GetMock<IConfigurationService>()
                .Expect(cs => cs.SmtpServer)
                .Returns("mail.domain.com");
            container.GetMock<ISmtpService>()
                .Expect(ss => ss.Send(It.IsAny<string>(), It.IsAny<MailMessage>()))
                .Returns(true).Callback((MailMessage message) => Assert.AreEqual(AGENCY_EMAIL, message.From.Address));

            messagingService = container.Create<IMessagingService>();
            messagingService.Send(new MessageBuilder().Build());
        }
 /// <summary>
 /// Send a message to the this contact using a messaging service
 /// </summary>
 public void SendMessage(IMessagingService messagingService, string subject, string message)
 {
     messagingService.Send(emailAddress, subject, message);
 }
Example #32
0
 public ObservabilityMessageSender(IMessagingService msgService)
 {
     this.msgService = msgService;
 }
Example #33
0
 /// <summary>
 /// Initializes an instance of <see cref="AllTransactionViewModel"/>.
 /// </summary>
 /// <param name="isUserAdmin">Gets if the logged in user is admin </param>
 /// <param name="registeredName">Registered name of this instance of <see cref="WorkspaceViewModelBase"/>.</param>
 /// <param name="userRepository"> </param>
 /// <param name="transactionRepository">An instance of transaction repository contract.</param>
 /// <param name="messagingService">An implementation of <see cref="IMessagingService"/>. </param>
 public AllTransactionViewModel(bool isUserAdmin, string registeredName, IUserRepository userRepository, ITransactionRepository transactionRepository, IMessagingService messagingService)
     : base(registeredName)
 {
     if (userRepository == null)
     {
         throw new ArgumentNullException("userRepository");
     }
     if (transactionRepository == null)
     {
         throw new ArgumentNullException("transactionRepository");
     }
     if (messagingService == null)
     {
         throw new ArgumentNullException("messagingService");
     }
     DisplayName            = UIText.EXPENSE_VIEW_HEADER;
     _userRepository        = userRepository;
     IsUserAdmin            = isUserAdmin;
     _transactionRepository = transactionRepository;
     _messagingService      = messagingService;
     CanGoBack = true;
     //Initialize commands
     AddNewTransactionCommand  = new RelayCommand(() => SelectedTransaction = new TransactionViewModel(_transactionRepository.GetNewTransaction()));
     SaveTransactionCommand    = new RelayCommand(SaveTransaction, CanSaveTransaction);
     DeleteTransactionsCommand = new RelayCommand(DeleteTransactions);
 }
 public MessagingController(IMessagingService messagingService)
 {
     _messagingService = messagingService;
 }
Example #35
0
 public OfficeHoursAPIController(IOfficeHourServices OfficeHourServices, IMessagingService messagingService)
 {
     this._officeHourServices = OfficeHourServices;
     this._messagingService   = messagingService;
 }
        public static async Task SignaturesOnDataBase(IProjectSettings projectSettings, IMessagingService messagingService,
                                                      ILoggerService loggerService)
        {
            var dateTimeNow = DateTime.Now;
            var timeElapsed = new TimeSpan((dateTimeNow - Properties.Settings.Default.SignaturesCheck).Ticks);

            if (timeElapsed.TotalHours > ProjectSettings.IntervalSignatureUpdate)
            {
                messagingService.ShowMessage("ะŸะตั€ะตะทะฐะณั€ัƒะทะบะฐ ั€ะตััƒั€ัะพะฒ...");
                loggerService.DebugLog("ะŸะตั€ะตะทะฐะณั€ัƒะทะบะฐ ั€ะตััƒั€ัะพะฒ...");

                await projectSettings.ConvertingResources.ReloadResources();

                Properties.Settings.Default.SignaturesCheck = new TimeSpan(dateTimeNow.Ticks);
                Properties.Settings.Default.Save();
            }
        }
Example #37
0
 public RabbitMqController(
     IMessagingService messaging)
 {
     _messaging = messaging ?? throw new ArgumentNullException(nameof(messaging));
 }
Example #38
0
        public static void Initialize(IMessagingService messagingService)
        {
            UnmanagedHandler = HandleUnmanagedException;


            byte[] gsl;

            if (Environment.Is64BitProcess && IntPtr.Size == 8)
            {
                gsl = GlobalConfig.IsUnix
                    ? (GlobalConfig.IsMacOS ? Resources.libgsl_osx_amd64 : Resources.libgsl_amd64)
                    : Resources.gsl_x64;
            }
            else if (!Environment.Is64BitProcess && IntPtr.Size == 4)
            {
                gsl = GlobalConfig.IsUnix
                    ? (GlobalConfig.IsMacOS ? Resources.libgsl_osx_i686 : Resources.libgsl_i686)
                    : Resources.gsl_x86;
            }
            else
            {
                throw new PlatformNotSupportedException("Inconsistent operating system. Handles only 32 and 64 bit OS.");
            }

            var cblas = Environment.Is64BitProcess
                ? (GlobalConfig.IsMacOS ? Resources.libgslcblas_osx_amd64 : Resources.libgslcblas_amd64)
                : (GlobalConfig.IsMacOS ? Resources.libgslcblas_osx_i686 : Resources.libgslcblas_i686);

            try
            {
                EmbeddedDllClass.ExtractEmbeddedDlls(GlobalConfig.GslDllName, gsl);


                if (GlobalConfig.IsUnix)
                {
                    EmbeddedDllClass.ExtractEmbeddedDlls(GlobalConfig.GslCblasDllName, cblas);
                }

                switch (Settings.Default.CalculationsErrors)
                {
                case CalculationsErrors.ReturnNAN:
                    NativeMethods.gsl_set_error_handler_off();
                    break;

                case CalculationsErrors.ShowError:
                    NativeMethods.gsl_set_error_handler(UnmanagedHandler);
                    break;
                }
            }
            catch (Exception exception)
            {
                logger.Log("ExtractEmbeddedDlls failed", ErrorType.General, exception);
                try
                {
                    var gslTempPath = Path.Combine(Path.GetTempPath(), GlobalConfig.GslDllName);

                    File.WriteAllBytes(gslTempPath, gsl);

                    if (GlobalConfig.IsUnix)
                    {
                        var cblasTempPath = Path.Combine(Path.GetTempPath(), GlobalConfig.GslCblasDllName);
                        File.WriteAllBytes(cblasTempPath, cblas);

                        var h1 = NativeMethods.dlopen(cblasTempPath, NativeMethods.RTLD.RTLD_GLOBAL);
                        if (h1 == IntPtr.Zero)
                        {
                            throw new Win32Exception(
                                      $"{Strings.GSLInitializer_Initialize_Could_not_load_the_Computator_NET_modules_at_the_paths} '{cblasTempPath}'{Environment.NewLine}.",
                                      new Win32Exception()); // Calls GetLastError
                        }
                    }

                    var h2 = GlobalConfig.IsUnix ? NativeMethods.dlopen(gslTempPath, NativeMethods.RTLD.RTLD_GLOBAL) : NativeMethods.LoadLibrary(gslTempPath);

                    if (h2 == IntPtr.Zero)
                    {
                        throw new Win32Exception(
                                  $"{Strings.GSLInitializer_Initialize_Could_not_load_the_Computator_NET_modules_at_the_paths} '{gslTempPath}'{Environment.NewLine}.",
                                  new Win32Exception()); // Calls GetLastError
                    }

                    NativeMethods.gsl_set_error_handler(UnmanagedHandler);
                }
                catch (Exception exception2)
                {
                    var funcName = GlobalConfig.IsUnix ? "dlopen" : "LoadLibrary";
                    logger.Log($"{funcName} failed", ErrorType.General, exception2);
                    messagingService.Show(
                        $"{Strings.Program_Main_Exception_during_startup}.{Environment.NewLine}ExtractEmbeddedDlls {Strings.Exception}:{Environment.NewLine}{exception}{Environment.NewLine}{funcName} {Strings.Exception}:{Environment.NewLine}{exception2}",
                        Strings.Error);
                }
            }
        }
        public AddEditPageViewModel()
        {
            _deviceActionService    = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _cipherService          = ServiceContainer.Resolve <ICipherService>("cipherService");
            _folderService          = ServiceContainer.Resolve <IFolderService>("folderService");
            _userService            = ServiceContainer.Resolve <IUserService>("userService");
            _platformUtilsService   = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _auditService           = ServiceContainer.Resolve <IAuditService>("auditService");
            _messagingService       = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _collectionService      = ServiceContainer.Resolve <ICollectionService>("collectionService");
            _eventService           = ServiceContainer.Resolve <IEventService>("eventService");
            GeneratePasswordCommand = new Command(GeneratePassword);
            TogglePasswordCommand   = new Command(TogglePassword);
            ToggleCardCodeCommand   = new Command(ToggleCardCode);
            CheckPasswordCommand    = new Command(CheckPasswordAsync);
            UriOptionsCommand       = new Command <LoginUriView>(UriOptions);
            FieldOptionsCommand     = new Command <AddEditPageFieldViewModel>(FieldOptions);
            Uris        = new ExtendedObservableCollection <LoginUriView>();
            Fields      = new ExtendedObservableCollection <AddEditPageFieldViewModel>();
            Collections = new ExtendedObservableCollection <CollectionViewModel>();

            TypeOptions = new List <KeyValuePair <string, CipherType> >
            {
                new KeyValuePair <string, CipherType>(AppResources.TypeLogin, CipherType.Login),
                new KeyValuePair <string, CipherType>(AppResources.TypeCard, CipherType.Card),
                new KeyValuePair <string, CipherType>(AppResources.TypeIdentity, CipherType.Identity),
                new KeyValuePair <string, CipherType>(AppResources.TypeSecureNote, CipherType.SecureNote),
            };
            CardBrandOptions = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>($"-- {AppResources.Select} --", null),
                new KeyValuePair <string, string>("Visa", "Visa"),
                new KeyValuePair <string, string>("Mastercard", "Mastercard"),
                new KeyValuePair <string, string>("American Express", "Amex"),
                new KeyValuePair <string, string>("Discover", "Discover"),
                new KeyValuePair <string, string>("Diners Club", "Diners Club"),
                new KeyValuePair <string, string>("JCB", "JCB"),
                new KeyValuePair <string, string>("Maestro", "Maestro"),
                new KeyValuePair <string, string>("UnionPay", "UnionPay"),
                new KeyValuePair <string, string>(AppResources.Other, "Other")
            };
            CardExpMonthOptions = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>($"-- {AppResources.Select} --", null),
                new KeyValuePair <string, string>($"01 - {AppResources.January}", "1"),
                new KeyValuePair <string, string>($"02 - {AppResources.February}", "2"),
                new KeyValuePair <string, string>($"03 - {AppResources.March}", "3"),
                new KeyValuePair <string, string>($"04 - {AppResources.April}", "4"),
                new KeyValuePair <string, string>($"05 - {AppResources.May}", "5"),
                new KeyValuePair <string, string>($"06 - {AppResources.June}", "6"),
                new KeyValuePair <string, string>($"07 - {AppResources.July}", "7"),
                new KeyValuePair <string, string>($"08 - {AppResources.August}", "8"),
                new KeyValuePair <string, string>($"09 - {AppResources.September}", "9"),
                new KeyValuePair <string, string>($"10 - {AppResources.October}", "10"),
                new KeyValuePair <string, string>($"11 - {AppResources.November}", "11"),
                new KeyValuePair <string, string>($"12 - {AppResources.December}", "12")
            };
            IdentityTitleOptions = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>($"-- {AppResources.Select} --", null),
                new KeyValuePair <string, string>(AppResources.Mr, AppResources.Mr),
                new KeyValuePair <string, string>(AppResources.Mrs, AppResources.Mrs),
                new KeyValuePair <string, string>(AppResources.Ms, AppResources.Ms),
                new KeyValuePair <string, string>(AppResources.Dr, AppResources.Dr),
            };
            FolderOptions    = new List <KeyValuePair <string, string> >();
            OwnershipOptions = new List <KeyValuePair <string, string> >();
        }
Example #40
0
 public DispatchDriverHandler(IMessagingService messagingService)
 {
     _messagingService = messagingService;
 }
Example #41
0
 public ProductDeletedEventConsumer(IMessagingService messagingService, IUnitOfWork unitOfWork, IProductReviewRepository productReviewRepository)
 {
     _messagingService        = messagingService;
     _unitOfWork              = unitOfWork;
     _productReviewRepository = productReviewRepository;
 }
        /// <summary>
        /// Initializes an instance of <see cref="ApplicationViewModel"/>.
        /// </summary>
        /// <param name="user">The view model that wraps the logged in user model. </param>
        /// <param name="transactionRepository">An instance of <see cref="ITransactionRepository"/> implementation.</param>
        /// <param name="userRepository"> >An instance of <see cref="IUserRepository"/> implementation.</param>
        /// <param name="messagingService">An implementation of <see cref="IMessagingService"/> </param>
        public ApplicationViewModel(UserViewModel user, ITransactionRepository transactionRepository, IUserRepository userRepository, IMessagingService messagingService)
            : base("ApplicationViewModel")
        {
            LoggedInUser = user;
            bool isUserAdmin = true;//user.Role == UserRole.Admin;

            //Configure the navigator
            Navigator = NavigatorFactory.GetNavigator();
            var viewList = new List <WorkspaceViewModelBase>()
            {
                new AllTransactionViewModel(isUserAdmin, Constants.ALLEXPENSES_VIEW_REGERED_NAME, userRepository, transactionRepository, messagingService),
                new ManageViewModel(Constants.MANAGE_VIEW_REGERED_NAME, userRepository, messagingService, isUserAdmin)
            };

            viewList.ForEach(wvm => Navigator.AddView(wvm));
            Navigator.AddHomeView(new HomeViewModel(viewList, Constants.HOME_VIEW_REGERED_NAME, messagingService));
            Navigator.PropertyChanged += NavigatorPropertyChanged;
            Navigator.NavigateToHome();
            //Initialie the commands
            NavigateBackCommand = new RelayCommand(Navigator.NavigateBack);
        }
Example #43
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Forms.Init();
            InitApp();

            _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _messagingService    = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _broadcasterService  = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService");
            _storageService      = ServiceContainer.Resolve <IStorageService>("storageService");
            _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService");
            _eventService        = ServiceContainer.Resolve <IEventService>("eventService");

            LoadApplication(new App.App(null));
            iOSCoreHelpers.AppearanceAdjustments(_deviceActionService);
            ZXing.Net.Mobile.Forms.iOS.Platform.Init();

            _broadcasterService.Subscribe(nameof(AppDelegate), async(message) =>
            {
                if (message.Command == "scheduleVaultTimeoutTimer")
                {
                    VaultTimeoutTimer((int)message.Data);
                }
                else if (message.Command == "cancelVaultTimeoutTimer")
                {
                    CancelVaultTimeoutTimer();
                }
                else if (message.Command == "startEventTimer")
                {
                    StartEventTimer();
                }
                else if (message.Command == "stopEventTimer")
                {
                    var task = StopEventTimerAsync();
                }
                else if (message.Command == "updatedTheme")
                {
                    // ThemeManager.SetThemeStyle(message.Data as string);
                }
                else if (message.Command == "copiedToClipboard")
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        var task = ClearClipboardTimerAsync(message.Data as Tuple <string, int?, bool>);
                    });
                }
                else if (message.Command == "listenYubiKeyOTP")
                {
                    iOSCoreHelpers.ListenYubiKey((bool)message.Data, _deviceActionService, _nfcSession, _nfcDelegate);
                }
                else if (message.Command == "unlocked")
                {
                    var needsAutofillReplacement = await _storageService.GetAsync <bool?>(
                        Core.Constants.AutofillNeedsIdentityReplacementKey);
                    if (needsAutofillReplacement.GetValueOrDefault())
                    {
                        await ASHelpers.ReplaceAllIdentities();
                    }
                }
                else if (message.Command == "showAppExtension")
                {
                    Device.BeginInvokeOnMainThread(() => ShowAppExtension((ExtensionPageViewModel)message.Data));
                }
                else if (message.Command == "showStatusBar")
                {
                    Device.BeginInvokeOnMainThread(() =>
                                                   UIApplication.SharedApplication.SetStatusBarHidden(!(bool)message.Data, false));
                }
                else if (message.Command == "syncCompleted")
                {
                    if (message.Data is Dictionary <string, object> data && data.ContainsKey("successfully"))
                    {
                        var success = data["successfully"] as bool?;
                        if (success.GetValueOrDefault() && _deviceActionService.SystemMajorVersion() >= 12)
                        {
                            await ASHelpers.ReplaceAllIdentities();
                        }
                    }
                }
                else if (message.Command == "addedCipher" || message.Command == "editedCipher" ||
                         message.Command == "restoredCipher")
                {
                    if (_deviceActionService.SystemMajorVersion() >= 12)
                    {
                        if (await ASHelpers.IdentitiesCanIncremental())
                        {
                            var cipherId = message.Data as string;
                            if (message.Command == "addedCipher" && !string.IsNullOrWhiteSpace(cipherId))
                            {
                                var identity = await ASHelpers.GetCipherIdentityAsync(cipherId);
                                if (identity == null)
                                {
                                    return;
                                }
                                await ASCredentialIdentityStore.SharedStore?.SaveCredentialIdentitiesAsync(
                                    new ASPasswordCredentialIdentity[] { identity });
                                return;
                            }
                        }
                        await ASHelpers.ReplaceAllIdentities();
                    }
                }
                else if (message.Command == "deletedCipher" || message.Command == "softDeletedCipher")
                {
                    if (_deviceActionService.SystemMajorVersion() >= 12)
                    {
                        if (await ASHelpers.IdentitiesCanIncremental())
                        {
                            var identity = ASHelpers.ToCredentialIdentity(
                                message.Data as Bit.Core.Models.View.CipherView);
                            if (identity == null)
                            {
                                return;
                            }
                            await ASCredentialIdentityStore.SharedStore?.RemoveCredentialIdentitiesAsync(
                                new ASPasswordCredentialIdentity[] { identity });
                            return;
                        }
                        await ASHelpers.ReplaceAllIdentities();
                    }
                }
                else if (message.Command == "loggedOut")
                {
                    if (_deviceActionService.SystemMajorVersion() >= 12)
                    {
                        await ASCredentialIdentityStore.SharedStore?.RemoveAllCredentialIdentitiesAsync();
                    }
                }
                else if ((message.Command == "softDeletedCipher" || message.Command == "restoredCipher") &&
                         _deviceActionService.SystemMajorVersion() >= 12)
                {
                    await ASHelpers.ReplaceAllIdentities();
                }
                else if (message.Command == "vaultTimeoutActionChanged")
                {
                    var timeoutAction = await _storageService.GetAsync <string>(Constants.VaultTimeoutActionKey);
                    if (timeoutAction == "logOut")
                    {
                        await ASCredentialIdentityStore.SharedStore?.RemoveAllCredentialIdentitiesAsync();
                    }
                    else
                    {
                        await ASHelpers.ReplaceAllIdentities();
                    }
                }
            });

            return(base.FinishedLaunching(app, options));
        }
 public LazySupportCaseProcessor(IMessagingService messagingService, IVerifier verifier, ISystemClock systemClock)
     : base(messagingService, verifier, systemClock)
 {
 }
 public MessagingController(IMessagingService msgSvc)
 {
     this._msgSvc = msgSvc;
 }
Example #46
0
 public WebLogManager(IMessagingService serv)
 {
     service = serv;
     text    = new StringBuilder($"***Logging started at {DateTime.Now.ToString()}***\n");
 }
Example #47
0
 public MyAwesomeClass(IMessagingService messenger)
 {
     this.messenger = messenger;
 }
Example #48
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            var eventUploadIntent = new Intent(this, typeof(EventUploadReceiver));

            _eventUploadPendingIntent = PendingIntent.GetBroadcast(this, 0, eventUploadIntent,
                                                                   PendingIntentFlags.UpdateCurrent);
            var alarmIntent = new Intent(this, typeof(LockAlarmReceiver));

            _vaultTimeoutAlarmPendingIntent = PendingIntent.GetBroadcast(this, 0, alarmIntent,
                                                                         PendingIntentFlags.UpdateCurrent);
            var clearClipboardIntent = new Intent(this, typeof(ClearClipboardAlarmReceiver));

            _clearClipboardPendingIntent = PendingIntent.GetBroadcast(this, 0, clearClipboardIntent,
                                                                      PendingIntentFlags.UpdateCurrent);

            var policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build();

            StrictMode.SetThreadPolicy(policy);

            _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _messagingService    = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _broadcasterService  = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService");
            _userService         = ServiceContainer.Resolve <IUserService>("userService");
            _appIdService        = ServiceContainer.Resolve <IAppIdService>("appIdService");
            _storageService      = ServiceContainer.Resolve <IStorageService>("storageService");
            _eventService        = ServiceContainer.Resolve <IEventService>("eventService");

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            UpdateTheme(ThemeManager.GetTheme(true));
            base.OnCreate(savedInstanceState);
            if (!CoreHelpers.InDebugMode())
            {
                Window.AddFlags(Android.Views.WindowManagerFlags.Secure);
            }

#if !FDROID
            var appCenterHelper = new AppCenterHelper(_appIdService, _userService);
            var appCenterTask   = appCenterHelper.InitAsync();
#endif

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            Xamarin.Forms.Forms.Init(this, savedInstanceState);
            _appOptions = GetOptions();
            LoadApplication(new App.App(_appOptions));

            _broadcasterService.Subscribe(_activityKey, (message) =>
            {
                if (message.Command == "scheduleVaultTimeoutTimer")
                {
                    var alarmManager        = GetSystemService(AlarmService) as AlarmManager;
                    var vaultTimeoutMinutes = (int)message.Data;
                    var vaultTimeoutMs      = vaultTimeoutMinutes * 60000;
                    var triggerMs           = Java.Lang.JavaSystem.CurrentTimeMillis() + vaultTimeoutMs + 10;
                    alarmManager.Set(AlarmType.RtcWakeup, triggerMs, _vaultTimeoutAlarmPendingIntent);
                }
                else if (message.Command == "cancelVaultTimeoutTimer")
                {
                    var alarmManager = GetSystemService(AlarmService) as AlarmManager;
                    alarmManager.Cancel(_vaultTimeoutAlarmPendingIntent);
                }
                else if (message.Command == "startEventTimer")
                {
                    StartEventAlarm();
                }
                else if (message.Command == "stopEventTimer")
                {
                    var task = StopEventAlarmAsync();
                }
                else if (message.Command == "finishMainActivity")
                {
                    Xamarin.Forms.Device.BeginInvokeOnMainThread(() => Finish());
                }
                else if (message.Command == "listenYubiKeyOTP")
                {
                    ListenYubiKey((bool)message.Data);
                }
                else if (message.Command == "updatedTheme")
                {
                    RestartApp();
                }
                else if (message.Command == "exit")
                {
                    ExitApp();
                }
                else if (message.Command == "copiedToClipboard")
                {
                    var task = ClearClipboardAlarmAsync(message.Data as Tuple <string, int?, bool>);
                }
            });
        }
Example #49
0
        public PosViewModel(IRegionManager regionManager, IApplicationState applicationState, IApplicationStateSetter applicationStateSetter,
                            ITicketService ticketService, ITicketServiceBase ticketServiceBase, IUserService userService, ICacheService cacheService, IMessagingService messagingService,
                            TicketListViewModel ticketListViewModel, TicketTagListViewModel ticketTagListViewModel, MenuItemSelectorViewModel menuItemSelectorViewModel,
                            MenuItemSelectorView menuItemSelectorView, TicketViewModel ticketViewModel, TicketOrdersViewModel ticketOrdersViewModel,
                            TicketEntityListViewModel ticketEntityListViewModel, TicketTypeListViewModel ticketTypeListViewModel, AccountBalances accountBalances)
        {
            _ticketService             = ticketService;
            _ticketServiceBase         = ticketServiceBase;
            _userService               = userService;
            _cacheService              = cacheService;
            _messagingService          = messagingService;
            _applicationState          = applicationState;
            _applicationStateSetter    = applicationStateSetter;
            _regionManager             = regionManager;
            _menuItemSelectorView      = menuItemSelectorView;
            _ticketViewModel           = ticketViewModel;
            _ticketOrdersViewModel     = ticketOrdersViewModel;
            _menuItemSelectorViewModel = menuItemSelectorViewModel;
            _ticketListViewModel       = ticketListViewModel;
            _ticketTagListViewModel    = ticketTagListViewModel;
            _ticketEntityListViewModel = ticketEntityListViewModel;
            _ticketTypeListViewModel   = ticketTypeListViewModel;
            _accountBalances           = accountBalances;

            EventServiceFactory.EventService.GetEvent <GenericEvent <Ticket> >().Subscribe(OnTicketEventReceived);
            EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe(OnTicketEvent);
            EventServiceFactory.EventService.GetEvent <GenericEvent <ScreenMenuItemData> >().Subscribe(OnMenuItemSelected);
            EventServiceFactory.EventService.GetEvent <GenericIdEvent>().Subscribe(OnTicketIdPublished);
            EventServiceFactory.EventService.GetEvent <GenericEvent <OperationRequest <Entity> > >().Subscribe(OnEntitySelectedForTicket);
            EventServiceFactory.EventService.GetEvent <GenericEvent <TicketTagGroup> >().Subscribe(OnTicketTagSelected);
            EventServiceFactory.EventService.GetEvent <GenericEvent <TicketStateData> >().Subscribe(OnTicketStateSelected);
            EventServiceFactory.EventService.GetEvent <GenericEvent <TicketType> >().Subscribe(OnTicketTypeChanged);

            EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe(
                x =>
            {
                if (x.Topic == EventTopicNames.ResetCache && _applicationState.CurrentTicketType != null)
                {
                    _menuItemSelectorViewModel.Reset();
                    _menuItemSelectorViewModel.UpdateCurrentScreenMenu(_applicationState.CurrentTicketType.GetScreenMenuId(_applicationState.CurrentTerminal));
                }
            });
        }
 public CompletedNotificationRule(IMessagingService messagingService)
 {
     _messagingService = messagingService ?? throw new ArgumentNullException(nameof(messagingService));
 }
 public SendMessage(IMessagingService messagingService)
 {
     _messagingService = messagingService;
 }
 public GetDialogsHandler(ILogger <GetDialogsHandler> logger, IMTSessionManager manager, IMessagingService messagingService, IContactService contactService)
 {
     this.logger           = logger;
     this.manager          = manager;
     this.messagingService = messagingService;
     this.contactService   = contactService;
 }
Example #53
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            var eventUploadIntent = new Intent(this, typeof(EventUploadReceiver));
            _eventUploadPendingIntent = PendingIntent.GetBroadcast(this, 0, eventUploadIntent,
                PendingIntentFlags.UpdateCurrent);

            var policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build();
            StrictMode.SetThreadPolicy(policy);

            _deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
            _messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
            _broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService");
            _stateService = ServiceContainer.Resolve<IStateService>("stateService");
            _appIdService = ServiceContainer.Resolve<IAppIdService>("appIdService");
            _eventService = ServiceContainer.Resolve<IEventService>("eventService");

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            // this needs to be called here before base.OnCreate(...)
            Intent?.Validate();

            base.OnCreate(savedInstanceState);

            _deviceActionService.SetScreenCaptureAllowedAsync().FireAndForget(_ =>
            {
                Window.AddFlags(Android.Views.WindowManagerFlags.Secure);
            });

            ServiceContainer.Resolve<ILogger>("logger").InitAsync();

            var toplayout = Window?.DecorView?.RootView;
            if (toplayout != null)
            {
                toplayout.FilterTouchesWhenObscured = true;
            }

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            Xamarin.Forms.Forms.Init(this, savedInstanceState);
            _appOptions = GetOptions();
            LoadApplication(new App.App(_appOptions));


            _broadcasterService.Subscribe(_activityKey, (message) =>
            {
                if (message.Command == "startEventTimer")
                {
                    StartEventAlarm();
                }
                else if (message.Command == "stopEventTimer")
                {
                    var task = StopEventAlarmAsync();
                }
                else if (message.Command == "finishMainActivity")
                {
                    Xamarin.Forms.Device.BeginInvokeOnMainThread(() => Finish());
                }
                else if (message.Command == "listenYubiKeyOTP")
                {
                    ListenYubiKey((bool)message.Data);
                }
                else if (message.Command == "updatedTheme")
                {
                    Xamarin.Forms.Device.BeginInvokeOnMainThread(() => AppearanceAdjustments());
                }
                else if (message.Command == "exit")
                {
                    ExitApp();
                }
            });
        }
Example #54
0
        public App(AppOptions appOptions)
        {
            _appOptions                = appOptions ?? new AppOptions();
            _userService               = ServiceContainer.Resolve <IUserService>("userService");
            _broadcasterService        = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService");
            _messagingService          = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _stateService              = ServiceContainer.Resolve <IStateService>("stateService");
            _lockService               = ServiceContainer.Resolve <ILockService>("lockService");
            _syncService               = ServiceContainer.Resolve <ISyncService>("syncService");
            _tokenService              = ServiceContainer.Resolve <ITokenService>("tokenService");
            _cryptoService             = ServiceContainer.Resolve <ICryptoService>("cryptoService");
            _cipherService             = ServiceContainer.Resolve <ICipherService>("cipherService");
            _folderService             = ServiceContainer.Resolve <IFolderService>("folderService");
            _settingsService           = ServiceContainer.Resolve <ISettingsService>("settingsService");
            _collectionService         = ServiceContainer.Resolve <ICollectionService>("collectionService");
            _searchService             = ServiceContainer.Resolve <ISearchService>("searchService");
            _authService               = ServiceContainer.Resolve <IAuthService>("authService");
            _platformUtilsService      = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _storageService            = ServiceContainer.Resolve <IStorageService>("storageService");
            _passwordGenerationService = ServiceContainer.Resolve <IPasswordGenerationService>(
                "passwordGenerationService");
            _i18nService         = ServiceContainer.Resolve <II18nService>("i18nService") as MobileI18nService;
            _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");

            InitializeComponent();
            SetCulture();
            ThemeManager.SetThemeStyle("light");
            MainPage = new HomePage();
            var mainPageTask = SetMainPageAsync();

            ServiceContainer.Resolve <MobilePlatformUtilsService>("platformUtilsService").Init();
            _broadcasterService.Subscribe(nameof(App), async(message) =>
            {
                if (message.Command == "showDialog")
                {
                    var details     = message.Data as DialogDetails;
                    var confirmed   = true;
                    var confirmText = string.IsNullOrWhiteSpace(details.ConfirmText) ?
                                      AppResources.Ok : details.ConfirmText;
                    if (!string.IsNullOrWhiteSpace(details.CancelText))
                    {
                        confirmed = await MainPage.DisplayAlert(details.Title, details.Text, confirmText,
                                                                details.CancelText);
                    }
                    else
                    {
                        await MainPage.DisplayAlert(details.Title, details.Text, confirmText);
                    }
                    _messagingService.Send("showDialogResolve", new Tuple <int, bool>(details.DialogId, confirmed));
                }
                else if (message.Command == "locked")
                {
                    await _stateService.PurgeAsync();
                    MainPage = new NavigationPage(new LockPage());
                }
                else if (message.Command == "lockVault")
                {
                    await _lockService.LockAsync(true);
                }
                else if (message.Command == "logout")
                {
                    await LogOutAsync(false);
                }
                else if (message.Command == "loggedOut")
                {
                    // TODO
                }
                else if (message.Command == "unlocked" || message.Command == "loggedIn")
                {
                    // TODO
                }
            });
        }
Example #55
0
        public App(AppOptions appOptions)
        {
            _appOptions                = appOptions ?? new AppOptions();
            _userService               = ServiceContainer.Resolve <IUserService>("userService");
            _broadcasterService        = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService");
            _messagingService          = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _stateService              = ServiceContainer.Resolve <IStateService>("stateService");
            _lockService               = ServiceContainer.Resolve <ILockService>("lockService");
            _syncService               = ServiceContainer.Resolve <ISyncService>("syncService");
            _tokenService              = ServiceContainer.Resolve <ITokenService>("tokenService");
            _cryptoService             = ServiceContainer.Resolve <ICryptoService>("cryptoService");
            _cipherService             = ServiceContainer.Resolve <ICipherService>("cipherService");
            _folderService             = ServiceContainer.Resolve <IFolderService>("folderService");
            _settingsService           = ServiceContainer.Resolve <ISettingsService>("settingsService");
            _collectionService         = ServiceContainer.Resolve <ICollectionService>("collectionService");
            _searchService             = ServiceContainer.Resolve <ISearchService>("searchService");
            _authService               = ServiceContainer.Resolve <IAuthService>("authService");
            _platformUtilsService      = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _storageService            = ServiceContainer.Resolve <IStorageService>("storageService");
            _secureStorageService      = ServiceContainer.Resolve <IStorageService>("secureStorageService");
            _passwordGenerationService = ServiceContainer.Resolve <IPasswordGenerationService>(
                "passwordGenerationService");
            _i18nService         = ServiceContainer.Resolve <II18nService>("i18nService") as MobileI18nService;
            _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");

            Bootstrap();
            _broadcasterService.Subscribe(nameof(App), async(message) =>
            {
                if (message.Command == "showDialog")
                {
                    var details     = message.Data as DialogDetails;
                    var confirmed   = true;
                    var confirmText = string.IsNullOrWhiteSpace(details.ConfirmText) ?
                                      AppResources.Ok : details.ConfirmText;
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        if (!string.IsNullOrWhiteSpace(details.CancelText))
                        {
                            confirmed = await Current.MainPage.DisplayAlert(details.Title, details.Text, confirmText,
                                                                            details.CancelText);
                        }
                        else
                        {
                            await Current.MainPage.DisplayAlert(details.Title, details.Text, confirmText);
                        }
                        _messagingService.Send("showDialogResolve", new Tuple <int, bool>(details.DialogId, confirmed));
                    });
                }
                else if (message.Command == "locked")
                {
                    await LockedAsync(!(message.Data as bool?).GetValueOrDefault());
                }
                else if (message.Command == "lockVault")
                {
                    await _lockService.LockAsync(true);
                }
                else if (message.Command == "logout")
                {
                    Device.BeginInvokeOnMainThread(async() =>
                                                   await LogOutAsync((message.Data as bool?).GetValueOrDefault()));
                }
                else if (message.Command == "loggedOut")
                {
                    // Clean up old migrated key if they ever log out.
                    await _secureStorageService.RemoveAsync("oldKey");
                }
                else if (message.Command == "resumed")
                {
                    if (Device.RuntimePlatform == Device.iOS)
                    {
                        ResumedAsync();
                    }
                }
                else if (message.Command == "slept")
                {
                    if (Device.RuntimePlatform == Device.iOS)
                    {
                        await SleptAsync();
                    }
                }
                else if (message.Command == "migrated")
                {
                    await Task.Delay(1000);
                    await SetMainPageAsync();
                }
                else if (message.Command == "popAllAndGoToTabGenerator" ||
                         message.Command == "popAllAndGoToTabMyVault")
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        if (Current.MainPage is TabsPage tabsPage)
                        {
                            while (tabsPage.Navigation.ModalStack.Count > 0)
                            {
                                await tabsPage.Navigation.PopModalAsync(false);
                            }
                            if (message.Command == "popAllAndGoToTabMyVault")
                            {
                                _appOptions.MyVaultTile = false;
                                tabsPage.ResetToVaultPage();
                            }
                            else
                            {
                                _appOptions.GeneratorTile = false;
                                tabsPage.ResetToGeneratorPage();
                            }
                        }
                    });
                }
            });
        }
 public MainWindow()
 {
     InitializeComponent();
     _channelFactory = new DuplexChannelFactory <IMessagingService>(new SpacecraftCallBack(), "MessagingServiceEndpoint");
     server          = _channelFactory.CreateChannel();
 }
 public AuditTrailController()
 {
     _messagingService = new MessagingService();
 }
Example #58
0
 /// <summary>
 ///     Constructor.
 /// </summary>
 /// <param name="messagingService">-</param>
 public SendMultipleDirectMessagesService(IMessagingService <MessagingParameters> messagingService) : base(
         messagingService)
 {
 }
Example #59
0
        public AuthService(
            ICryptoService cryptoService,
            IApiService apiService,
            IUserService userService,
            ITokenService tokenService,
            IAppIdService appIdService,
            II18nService i18nService,
            IPlatformUtilsService platformUtilsService,
            IMessagingService messagingService,
            IVaultTimeoutService vaultTimeoutService,
            bool setCryptoKeys = true)
        {
            _cryptoService        = cryptoService;
            _apiService           = apiService;
            _userService          = userService;
            _tokenService         = tokenService;
            _appIdService         = appIdService;
            _i18nService          = i18nService;
            _platformUtilsService = platformUtilsService;
            _messagingService     = messagingService;
            _vaultTimeoutService  = vaultTimeoutService;
            _setCryptoKeys        = setCryptoKeys;

            TwoFactorProviders = new Dictionary <TwoFactorProviderType, TwoFactorProvider>();
            TwoFactorProviders.Add(TwoFactorProviderType.Authenticator, new TwoFactorProvider
            {
                Type     = TwoFactorProviderType.Authenticator,
                Priority = 1,
                Sort     = 1
            });
            TwoFactorProviders.Add(TwoFactorProviderType.YubiKey, new TwoFactorProvider
            {
                Type     = TwoFactorProviderType.YubiKey,
                Priority = 3,
                Sort     = 2,
                Premium  = true
            });
            TwoFactorProviders.Add(TwoFactorProviderType.Duo, new TwoFactorProvider
            {
                Type     = TwoFactorProviderType.Duo,
                Name     = "Duo",
                Priority = 2,
                Sort     = 3,
                Premium  = true
            });
            TwoFactorProviders.Add(TwoFactorProviderType.OrganizationDuo, new TwoFactorProvider
            {
                Type     = TwoFactorProviderType.OrganizationDuo,
                Name     = "Duo (Organization)",
                Priority = 10,
                Sort     = 4
            });
            TwoFactorProviders.Add(TwoFactorProviderType.U2f, new TwoFactorProvider
            {
                Type     = TwoFactorProviderType.U2f,
                Priority = 4,
                Sort     = 5,
                Premium  = true
            });
            TwoFactorProviders.Add(TwoFactorProviderType.Email, new TwoFactorProvider
            {
                Type     = TwoFactorProviderType.Email,
                Priority = 0,
                Sort     = 6,
            });
        }
 public SimpleErrorHandler(IMessagingService messagingService)
 {
     _messagingService = messagingService;
 }