protected virtual void CancelCancellation(ICancellation entity)
 {
     entity.CancelledUserId = UserID;
     entity.CancelledUserIp = this.GetUserIP();
     entity.CancelDate      = DateTime.Now;
     entity.Cancelled       = true;
 }
 public SetPassphraseView(Toplevel topLevel) : base(topLevel)
 {
     this.mainWindow          = (Window)topLevel;
     this.messageBoxService   = App.ServiceProvider.Get <IMessageBoxService>();
     this.onboardingViewModel = App.ServiceProvider.Get <OnboardingViewModel>();
     this.deviceVaultService  = App.ServiceProvider.Get <DeviceVaultService>();
     this.cancellation        = App.ServiceProvider.Get <ICancellation>();
 }
Beispiel #3
0
 public BaseCancellation(ICancellation cancellation)
 {
     StringId         = cancellation.StringId;
     Reason           = cancellation.Reason;
     Status           = cancellation.Status;
     Date             = cancellation.Date;
     CancellationType = cancellation.CancellationType;
 }
 public LockScreenView(Window mainWindow) : base(mainWindow)
 {
     this.mainWindow         = mainWindow;
     this.deviceVaultService = App.ServiceProvider.Get <DeviceVaultService>();
     this.profileViewModel   = App.ServiceProvider.Get <ProfileViewModel>();
     this.chatWorker         = App.ServiceProvider.Get <ChatWorker>();
     this.cancellation       = App.ServiceProvider.Get <ICancellation>();
     this.peerManager        = App.ServiceProvider.Get <PeerManager>(); // we need to trigger the c'tor in PeerManager so that it registers as worker
 }
Beispiel #5
0
        public MessageRelayConnectionFactory(ILoggerFactory loggerFactory, ICancellation cancellation, MessageRelayRecordRepository messageRelayRecords)
        {
            this.messageRelayRecords = messageRelayRecords;
            this.connections         = new ConcurrentDictionary <string, MessageRelayConnection>();
            this.cancellation        = cancellation;
            this.logger = loggerFactory.CreateLogger <MessageRelayConnectionFactory>();

            cancellation.RegisterWorker(this);
        }
Beispiel #6
0
 public SetupView(Toplevel topLevel) : base(topLevel)
 {
     this.mainWindow              = (Window)topLevel;
     this.messageBoxService       = App.ServiceProvider.Get <IMessageBoxService>();
     this.onboardingViewModel     = App.ServiceProvider.Get <OnboardingViewModel>();
     this.stopwatch               = new Stopwatch();
     this.xdsSecService           = App.ServiceProvider.Get <IXDSSecService>();
     this.chatClientConfiguration = App.ServiceProvider.GetService <IChatClientConfiguration>();
     this.cancellation            = App.ServiceProvider.Get <ICancellation>();
 }
Beispiel #7
0
        public MainView(Toplevel topLevel) : base(topLevel)
        {
            this.topLevel = topLevel;

            this.colorScheme          = Theme.CreateColorScheme();
            this.topLevel.ColorScheme = this.colorScheme;

            this.chatClientConfiguration = App.ServiceProvider.Get <IChatClientConfiguration>();
            this.cancellation            = App.ServiceProvider.Get <ICancellation>();
        }
        protected virtual async Task CancelSaveAsync(ICancellation entity)
        {
            if (string.IsNullOrEmpty((entity.CancellationReason)))
            {
                throw new Exception(string.Format("{0} required!", EntityStrings.CancellationReason));
            }

            CancelCancellation(entity);
            await DataContext.SaveChangesAsync(this);
        }
Beispiel #9
0
 public ServerConnector(
     ICancellation cancellation,
     IAppSettings settings,
     IJsonSerializer jsonSerializer,
     IRestClientFactory restClientFactory)
 {
     _serverUrl      = new Uri(settings["server_url"] as string);
     _restClient     = new RestClient(_serverUrl);
     _settings       = settings;
     _jsonSerializer = jsonSerializer;
 }
Beispiel #10
0
 public App(
     ICancellation cancellation,
     StableDeviceCollector stableDeviceCollector,
     VolatileDeviceCollector volatileDeviceCollector,
     ServerConnector serverConnector,
     IJsonSerializer jsonSerializer)
 {
     _cancellation            = cancellation;
     _stableDeviceCollector   = stableDeviceCollector;
     _volatileDeviceCollector = volatileDeviceCollector;
     _serverConnector         = serverConnector;
     _jsonSerializer          = jsonSerializer;
 }
Beispiel #11
0
 public ChatWorker(ILoggerFactory loggerFactory, ICancellation cancellation, AppState appState, AppRepository appRepository, ITcpConnection tcpConnection, IUdpConnection udpConnection, IChatClient chatClient, IXDSSecService ixdsCryptoService, IChatEncryptionService chatEncryptionService, E2ERatchet e2eRatchet, ContactListManager contactListManager)
 {
     this.logger                = loggerFactory.CreateLogger <ChatWorker>();
     this.appState              = appState;
     this.repo                  = appRepository;
     this.tcp                   = tcpConnection;
     this.udp                   = udpConnection;
     this.chatClient            = chatClient;
     this.ixdsCryptoService     = ixdsCryptoService;
     this.chatEncryptionService = chatEncryptionService;
     this.e2eRatchet            = e2eRatchet;
     this.contactListManager    = contactListManager;
     this.cancellation          = cancellation;
     cancellation.RegisterWorker(this);
 }
Beispiel #12
0
        public PeerManager(ILoggerFactory loggerFactory, ICancellation cancellation,
                           IChatClientConfiguration chatClientConfiguration, PeerRepository peerRepository, IMessageRelayAddressReceiver messageRelayAddressReceiver)
        {
            this.loggerFactory = loggerFactory;
            this.cancellation  = cancellation;
            this.cancellation.RegisterWorker(this);
            this.chatClientConfiguration = (ChatClientConfiguration)chatClientConfiguration;

            this.logger = this.loggerFactory.CreateLogger <PeerManager>();



            this.peerRepository = peerRepository;
            this.messageRelayAddressReceiver = messageRelayAddressReceiver;
        }
Beispiel #13
0
        public override void ExecuteRecursive([NotNull] TaskExecutionNode node)
        {
            var taskDictionary = CreateTaskDictionary(node);
            var listener       = new ReSharperRunListener(Server, taskDictionary);
            var runIntent      = CreateRunIntent(node);

            _cancellation = runIntent.CancellationTokenSource;

            try
            {
                Evaluator.Run(runIntent, listener);
            }
            catch (Exception)
            {
                Server.SetTempFolderPath(runIntent.ShadowCopyPath);
                throw;
            }
        }
        static async Task <int> Main(string[] args)
        {
            try
            {
                var dataDirRoot = SelectDataDirRoot();

                Configure(dataDirRoot);

                CreateLogger();

                _cancellation = App.ServiceProvider.GetService <ICancellation>();

                Console.CancelKeyPress += (s, e) =>
                {
                    e.Cancel = true;
                    _cancellation.Cancel();
                };

                App.IsOnboardingRequired = await _cancellation.PrepareLaunch(dataDirRoot);

                App.ShowUI();

                while (!_cancellation.Token.IsCancellationRequested)
                {
                    _logger.LogInformation("Please press 'C' to go back to the chat application, 'Ctrl-C' to quit.");
                    var key = Console.ReadKey(true);
                    if (key.KeyChar == 'c' || key.KeyChar == 'C')
                    {
                        App.ShowUI();
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"There was an error running the program: {e}");
                return(1);
            }

            return(0);
        }
Beispiel #15
0
        public ServerConnector(
            ICancellation cancellation,
            IAppSettings settings,
            IJsonSerializer jsonSerializer,
            IRestClientFactory restClientFactory)
        {
            _cancellation   = cancellation;
            _jsonSerializer = jsonSerializer;

            _restClient = restClientFactory.Create();

            _tokenUrl  = new Uri(settings["auth_token_url"] as string);
            _serverUrl = new Uri(settings["server_url"] as string);

            _tokenRequest = new TokenRequest
            {
                ClientId     = settings["auth_client_id"] as string,
                ClientSecret = settings["auth_client_secret"] as string,
                Audience     = settings["auth_audience"] as string,
                GrantType    = "client_credentials"
            };
        }
Beispiel #16
0
 public CancellationController(ICancellation injected)
 {
     canceller = injected;
 }
Beispiel #17
0
 public Task FrameDelay(uint milliSeconds, ICancellation cancellation)
 {
     return(Task.Delay(TimeSpan.FromMilliseconds(milliSeconds), cancellation.Source.Token));
 }
 public CancellationController(ICancellation injected)
 {
     canceller = injected;
 }
Beispiel #19
0
 public DriveCollector(ICancellation cancellation)
 {
     _cancellation = cancellation;
 }
Beispiel #20
0
 public FileService(ICancellation cancellation)
 {
     this.cancellation = cancellation;
 }
 public NetworkCollector(ICancellation cancellation)
 {
     _cancellation = cancellation;
 }
 public ServerConnectorTests()
 {
     _mockCancellation = new Mock <ICancellation>().Object;
 }
Beispiel #23
0
 public CpuCollector(ICancellation cancellation)
 {
     _cancellation = cancellation;
 }
Beispiel #24
0
 public Cancellation(ICancellation cancellation)
     : base(cancellation)
 {
 }
Beispiel #25
0
 public OsCollector(ICancellation cancellation, ILogger logger = null)
 {
     _cancellation = cancellation;
     _logger       = logger;
 }
 public SoftwareCollector(ICancellation cancellation)
 {
     _cancellation = cancellation;
 }
Beispiel #27
0
 public MemoryCollector(ICancellation cancellation)
 {
     _cancellation = cancellation;
 }