public SessionRequestService(IUnitOfWork uow, Lazy<INotificationService> notificationService, ISessionService sessionService)
 {
     _sessionService = sessionService;
     _notificationService = notificationService;
     _uow = uow;
     _sessionRequest = uow.Set<SessionRequest>();
 }
 public IdentityService(ILearnWithQBUow uow, IEncryptionService encryptionService, ISessionService sessionService, ICacheProvider cacheProvider)
     : base(cacheProvider)
 {
     this.uow = uow;
     this.sessionService = sessionService;
     this.encryptionService = encryptionService;
 }
Ejemplo n.º 3
0
        public PullRequestsViewModel(ISessionService sessionService)
		{
            _sessionService = sessionService;
            Title = "Pull Requests";

            PullRequests = _pullRequests.CreateDerivedCollection(x => {
                    var vm = new PullRequestItemViewModel(x);
                    vm.GoToCommand.Subscribe(_ => {
                        var prViewModel = this.CreateViewModel<PullRequestViewModel>();
                        prViewModel.Init(RepositoryOwner, RepositoryName, x.Number, x);
                        NavigateTo(prViewModel);

                        prViewModel.WhenAnyValue(y => y.Issue.State)
                            .DistinctUntilChanged()
                            .Skip(1)
                            .Subscribe(y => LoadCommand.ExecuteIfCan());
                    });
                    return vm;
                },
                filter: x => x.Title.ContainsKeyword(SearchKeyword),
                signalReset: this.WhenAnyValue(x => x.SearchKeyword));

            LoadCommand = ReactiveCommand.CreateAsyncTask(async t => {
                _pullRequests.Reset(await RetrievePullRequests());
            });

            this.WhenAnyValue(x => x.SelectedFilter).Skip(1).Subscribe(_ => {
                _pullRequests.Clear();
                LoadCommand.ExecuteIfCan();
            });
		}
Ejemplo n.º 4
0
        public FeedbackComposerViewModel(ISessionService applicationService, IAlertDialogFactory alertDialogFactory)
        {
            this.WhenAnyValue(x => x.IsFeature).Subscribe(x => Title = x ? "New Feature" : "Bug Report");

            SubmitCommand = ReactiveCommand.CreateAsyncTask(
                this.WhenAnyValue(x => x.Subject).Select(x => !string.IsNullOrEmpty(x)),
                async _ =>
            {
                if (string.IsNullOrEmpty(Subject))
                    throw new ArgumentException(string.Format("You must provide a title for this {0}!", IsFeature ? "feature" : "bug"));

                var labels = await applicationService.GitHubClient.Issue.Labels.GetAllForRepository(CodeHubOwner, CodeHubName);
                var createLabels = labels.Where(x => string.Equals(x.Name, IsFeature ? "feature request" : "bug", StringComparison.OrdinalIgnoreCase)).Select(x => x.Name).Distinct();

                var createIssueRequest = new Octokit.NewIssue(Subject) { Body = Description };
                foreach (var label in createLabels)
                    createIssueRequest.Labels.Add(label);
                var createdIssue = await applicationService.GitHubClient.Issue.Create(CodeHubOwner, CodeHubName, createIssueRequest);

                _createdIssueSubject.OnNext(createdIssue);
                Dismiss();
            });

            DismissCommand = ReactiveCommand.CreateAsyncTask(async t =>
            {
                if (string.IsNullOrEmpty(Description) && string.IsNullOrEmpty(Subject))
                    return true;
                var itemType = IsFeature ? "feature" : "bug";
                return await alertDialogFactory.PromptYesNo("Discard " + itemType.Transform(To.TitleCase) + "?", "Are you sure you want to discard this " + itemType + "?");
            });
            DismissCommand.Where(x => x).Subscribe(_ => Dismiss());
        }
Ejemplo n.º 5
0
        public MyIssuesViewModel(ISessionService sessionService)
            : base(sessionService)
        {
            _sessionService = sessionService;

            Title = "My Issues";
            Filter = MyIssuesFilterModel.CreateOpenFilter();

            _selectedFilter = this.WhenAnyValue(x => x.Filter)
                .Select(x =>
                {
                    if (x == null || _openFilter.Equals(x))
                        return 0;
                    return _closedFilter.Equals(x) ? 1 : -1;
                })
                .ToProperty(this, x => x.SelectedFilter);

            this.WhenAnyValue(x => x.Filter).Skip(1).Subscribe(filter => {
                InternalItems.Clear();
                LoadCommand.ExecuteIfCan();
                CustomFilterEnabled = !(filter == _closedFilter || filter == _openFilter);
            });

            GoToFilterCommand = ReactiveCommand.Create();
            GoToFilterCommand.Subscribe(_ => {
                var vm = this.CreateViewModel<MyIssuesFilterViewModel>();
                vm.Init(Filter);
                vm.SaveCommand.Subscribe(filter => Filter = filter);
                NavigateTo(vm);
            });
        }
Ejemplo n.º 6
0
        public UserGistsViewModel(ISessionService sessionService)
            : base(sessionService)
        {
            _sessionService = sessionService;
            Username = _sessionService.Account.Username;

            GoToCreateGistCommand = ReactiveCommand.Create();
            GoToCreateGistCommand.Subscribe(_ =>
            {
                var vm = this.CreateViewModel<GistCreateViewModel>();
                vm.SaveCommand
                    .Delay(TimeSpan.FromMilliseconds(200))
                    .ObserveOn(RxApp.MainThreadScheduler)
                    .Subscribe(x => InternalItems.Insert(0, x));
                NavigateTo(vm);
            });

            this.WhenAnyValue(x => x.Username).Subscribe(x =>
            {
                if (IsMine)
                    Title = "My Gists";
                else if (x == null) 
                    Title = "Gists";
                else if (x.EndsWith("s", StringComparison.OrdinalIgnoreCase))
                    Title = x + "' Gists";
                else
                    Title = x + "'s Gists";
            });
        }
Ejemplo n.º 7
0
        public IssuesViewModel(ISessionService sessionService)
            : base(sessionService)
	    {
            _sessionService = sessionService;
            Filter = new IssuesFilterModel();

            Title = "Issues";

            GoToNewIssueCommand = ReactiveCommand.Create();
	        GoToNewIssueCommand.Subscribe(_ => {
	            var vm = this.CreateViewModel<IssueAddViewModel>();
                vm.RepositoryOwner = RepositoryOwner;
	            vm.RepositoryName = RepositoryName;
                vm.SaveCommand.Subscribe(x => LoadCommand.ExecuteIfCan());
                NavigateTo(vm);
	        });

            this.WhenAnyValue(x => x.Filter).Skip(1).Subscribe(filter => {
                InternalItems.Clear();
                LoadCommand.ExecuteIfCan();
                //CustomFilterEnabled = !(filter == _closedFilter || filter == _openFilter);
            });

            GoToFilterCommand = ReactiveCommand.Create();
            GoToFilterCommand.Subscribe(_ => {
                var vm = this.CreateViewModel<RepositoryIssuesFilterViewModel>();
                vm.Init(RepositoryOwner, RepositoryName, Filter);
                vm.SaveCommand.Subscribe(filter => {
                    Filter = filter;
                    FilterSelection = IssueFilterSelection.Custom;
                });
                NavigateTo(vm);
            });
	    }
Ejemplo n.º 8
0
        protected BaseRepositoriesViewModel(ISessionService applicationService)
        {
            ApplicationService = applicationService;
            ShowRepositoryOwner = true;
            Title = "Repositories";

            var gotoRepository = new Action<RepositoryItemViewModel>(x => {
                var vm = this.CreateViewModel<RepositoryViewModel>();
                vm.Init(x.Owner, x.Name);
                NavigateTo(vm);
            });

            var repositories = new ReactiveList<RepositoryItemViewModel>();
            Repositories = repositories.CreateDerivedCollection(
                x => x, 
                filter: x => x.Name.ContainsKeyword(SearchKeyword),
                signalReset: this.WhenAnyValue(x => x.SearchKeyword));

            //Filter = applicationService.Account.Filters.GetFilter<RepositoriesFilterModel>(filterKey);

            LoadCommand = ReactiveCommand.CreateAsyncTask(t =>
                repositories.SimpleCollectionLoad(CreateRequest(),
                    x => new RepositoryItemViewModel(x.Name, x.Owner.Login, x.Owner.AvatarUrl, 
                        ShowRepositoryDescription ? x.Description : string.Empty, x.StargazersCount, x.ForksCount, 
                        ShowRepositoryOwner, gotoRepository),
                    x => LoadMoreCommand = x == null ? null : ReactiveCommand.CreateAsyncTask(_ => x())));

//			_repositories.FilteringFunction = x => Repositories.Filter.Ascending ? x.OrderBy(y => y.Name) : x.OrderByDescending(y => y.Name);
//            _repositories.GroupingFunction = CreateGroupedItems;
        }
 public IdentityService(IVideoOnDemandUow uow, IEncryptionService encryptionService, ISessionService sessionService, ICacheProvider cacheProvider)
     : base(cacheProvider)
 {
     this.uow = uow;
     this.sessionService = sessionService;
     this.encryptionService = encryptionService;
 }
Ejemplo n.º 10
0
        public CreateFileViewModel(ISessionService sessionService, IAlertDialogFactory alertDialogFactory)
        {
            Title = "Create File";

            this.WhenAnyValue(x => x.Name)
                .Subscribe(x => CommitMessage = "Created " + x);

            GoToCommitMessageCommand = ReactiveCommand.Create(
                this.WhenAnyValue(x => x.Name, x => !string.IsNullOrEmpty(x)));

            SaveCommand = ReactiveCommand.CreateAsyncTask(
                this.WhenAnyValue(x => x.Name).Select(x => !string.IsNullOrEmpty(x)), async _ => {
                    var content = Content ?? string.Empty;
                    var path = System.IO.Path.Combine(Path ?? string.Empty, Name);
                    var request = new Octokit.CreateFileRequest(CommitMessage, content) { Branch = Branch };
                    using (alertDialogFactory.Activate("Commiting..."))
                        return await sessionService.GitHubClient.Repository.Content.CreateFile(RepositoryOwner, RepositoryName, path, request);
                });
            SaveCommand.Subscribe(x => Dismiss());

            DismissCommand = ReactiveCommand.CreateAsyncTask(async t => {
                if (string.IsNullOrEmpty(Name) && string.IsNullOrEmpty(Content)) return true;
                return await alertDialogFactory.PromptYesNo("Discard File?", "Are you sure you want to discard this file?");
            });
            DismissCommand.Where(x => x).Subscribe(_ => Dismiss());
        }
Ejemplo n.º 11
0
        public CreateFileViewModel(ISessionService applicationService, IAlertDialogFactory alertDialogFactory)
        {
            Title = "Create File";

            this.WhenAnyValue(x => x.Name).Subscribe(x => CommitMessage = "Created " + x);

            _canCommit = this.WhenAnyValue(x => x.Name)
                .Select(x => !string.IsNullOrEmpty(x))
                .ToProperty(this, x => x.CanCommit);

            SaveCommand = ReactiveCommand.CreateAsyncTask(
                this.WhenAnyValue(x => x.Name).Select(x => !string.IsNullOrEmpty(x)), 
                async _ =>
            {
                var content = Content ?? string.Empty;

                var path = Path;
                if (string.IsNullOrEmpty(Path))
                    path = "/";
                path = System.IO.Path.Combine(path, Name);
                var request = applicationService.Client.Users[RepositoryOwner].Repositories[RepositoryName].UpdateContentFile(path, CommitMessage, content, null, Branch);
                await applicationService.Client.ExecuteAsync(request);
                Dismiss();
            });

            DismissCommand = ReactiveCommand.CreateAsyncTask(async t =>
            {
                if (string.IsNullOrEmpty(Name) && string.IsNullOrEmpty(Content)) return true;
                return await alertDialogFactory.PromptYesNo("Discard File?", "Are you sure you want to discard this file?");
            });
            DismissCommand.Where(x => x).Subscribe(_ => Dismiss());
        }
Ejemplo n.º 12
0
        protected BaseUsersViewModel(ISessionService sessionService)
        {
            SessionService = sessionService;

            Users = _users.CreateDerivedCollection(x => {
                var isOrg = x.Type.HasValue && x.Type.Value == AccountType.Organization;
                return new UserItemViewModel(x.Login, x.AvatarUrl, isOrg, () => {
                    if (isOrg)
                    {
                        var vm = this.CreateViewModel<OrganizationViewModel>();
                        vm.Init(x.Login);
                        NavigateTo(vm);
                    }
                    else
                    {
                        var vm = this.CreateViewModel<UserViewModel>();
                        vm.Init(x.Login, x);
                        NavigateTo(vm);
                    }
                });
            },
            x => x.Login.StartsWith(SearchKeyword ?? string.Empty, StringComparison.OrdinalIgnoreCase),
            signalReset: this.WhenAnyValue(x => x.SearchKeyword));

            LoadCommand = ReactiveCommand.CreateAsyncTask(async t => {
                _users.Reset(await RetrieveUsers());
            });
        }
 public OrganizationRepositoriesViewModel(ISessionService applicationService)
     : base(applicationService)
 {
     _applicationService = applicationService;
     this.WhenAnyValue(x => x.Name).Subscribe(x => Title = x ?? "Repositories");
     ShowRepositoryOwner = false;
 }
Ejemplo n.º 14
0
 public ExploreViewModel(ISessionService applicationService)
 {
     Title = "Explore";
     Repositories = new RepositoryExploreViewModel(applicationService);
     Users = new UserExploreViewModel(applicationService);
     SearchCommand = ReactiveCommand.Create();
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        /// <param name="navigationService">
        /// The navigation Service.
        /// </param>
        /// <param name="logManager">
        /// The log manager.
        /// </param>
        /// <param name="sessionService">The session service.</param>
        public MainViewModel(INavigationService navigationService, 
            ILogManager logManager, 
            ISessionService sessionService)
        {
            _navigationService = navigationService;
            _logManager = logManager;
            _sessionService = sessionService;
            LogoutCommand = new RelayCommand(
                () =>
                {
                    _sessionService.Logout();

                    // todo navigation
                    _navigationService.Navigate<LoginView>();
                });
            AboutCommand = new RelayCommand(
                async () =>
                { 
                    Exception exception = null;
                    try
                    {
                        // todo navigation
                        // _navigationService.Navigate(new Uri(Constants.AboutView, UriKind.Relative));
                    }
                    catch (Exception ex)
                    {
                        exception = ex;
                    }

                    if (exception != null)
                    {
                        await _logManager.LogAsync(exception);
                    }
                });
        }
Ejemplo n.º 16
0
 public PullRequestRepository(ISessionService sessionService, string repositoryOwner, string repositoryName, int id)
 {
     _sessionService = sessionService;
     RepositoryOwner = repositoryOwner;
     RepositoryName = repositoryName;
     Id = id;
 }
Ejemplo n.º 17
0
 public BugsController(ISessionService sessionService, IFindBugsByUserEmail findByUserEmail, ICreateNewBug createNewBug, IRemoveBug removeBug)
 {
     this.sessionService = sessionService;
     this.findByUserEmail = findByUserEmail;
     this.createNewBug = createNewBug;
     this.removeBug = removeBug;
 }
 public IdentityService(IWeddingBiddersUow uow, IEncryptionService encryptionService, ISessionService sessionService, ICacheProvider cacheProvider)
     : base(cacheProvider)
 {
     this.uow = uow;
     this.sessionService = sessionService;
     this.encryptionService = encryptionService;
 }
Ejemplo n.º 19
0
        public ReadmeViewModel(
            ISessionService applicationService, 
            IActionMenuFactory actionMenuService)
        {
            Title = "Readme";

            var nonNullContentModel = this.WhenAnyValue(x => x.ContentModel).Select(x => x != null);

            ShareCommand = ReactiveCommand.Create(nonNullContentModel);
            ShareCommand.Subscribe(sender => actionMenuService.ShareUrl(sender, ContentModel.HtmlUrl));

            GoToGitHubCommand = ReactiveCommand.Create(nonNullContentModel);
            GoToGitHubCommand.Select(_ => ContentModel.HtmlUrl).Subscribe(GoToWebBrowser);

            GoToLinkCommand = ReactiveCommand.Create();
            GoToLinkCommand.OfType<string>().Subscribe(x => GoToWebBrowser(new Uri(x)));

            ShowMenuCommand = ReactiveCommand.CreateAsyncTask(nonNullContentModel, sender => {
                var menu = actionMenuService.Create();
                menu.AddButton("Share", ShareCommand);
                menu.AddButton("Show in GitHub", GoToGitHubCommand);
                return menu.Show(sender);
            });

            LoadCommand = ReactiveCommand.CreateAsyncTask(x => {
                var contentTask = applicationService.GitHubClient.Repository.Content.GetReadmeHtml(RepositoryOwner, RepositoryName)
                    .ContinueWith(t => ContentText = t.Result, TaskScheduler.FromCurrentSynchronizationContext());
                
                var modelTask = applicationService.GitHubClient.Repository.Content.GetReadme(RepositoryOwner, RepositoryName)
                    .ContinueWith(t => ContentModel = t.Result, TaskScheduler.FromCurrentSynchronizationContext());

                return Task.WhenAll(contentTask, modelTask);
            });
        }
Ejemplo n.º 20
0
        public IssuesViewModel(ISessionService sessionService, IActionMenuFactory actionMenuFactory)
            : base(sessionService)
	    {
            _sessionService = sessionService;
            Filter = new RepositoryIssuesFilterViewModel(sessionService, actionMenuFactory);

            Title = "Issues";

            GoToNewIssueCommand = ReactiveCommand.Create();
	        GoToNewIssueCommand.Subscribe(_ => {
	            var vm = this.CreateViewModel<IssueAddViewModel>();
                vm.RepositoryOwner = RepositoryOwner;
	            vm.RepositoryName = RepositoryName;
                vm.SaveCommand.Subscribe(x => LoadCommand.ExecuteIfCan());
                NavigateTo(vm);
	        });

            Filter.SaveCommand.Subscribe(_ => {
                IssuesBacking.Clear();
                LoadCommand.ExecuteIfCan();
            });

            GoToCustomFilterCommand = ReactiveCommand.Create();
            GoToCustomFilterCommand.Subscribe(_ => FilterSelection = IssueFilterSelection.Custom);
	    }
Ejemplo n.º 21
0
        public AccountsViewModel(ISessionService sessionService, IAccountsRepository accountsRepository)
        {
            _accountsRepository = accountsRepository;
            _sessionService = sessionService;

            Title = "Accounts";

            Accounts = _accounts.CreateDerivedCollection(CreateAccountItem);

            this.WhenAnyValue(x => x.ActiveAccount)
                .Select(x => x == null ? string.Empty : x.Key)
                .Subscribe(x =>
                {
                    foreach (var account in Accounts)
                        account.Selected = account.Id == x;
                });

            var canDismiss = this.WhenAnyValue(x => x.ActiveAccount).Select(x => x != null);
            DismissCommand = ReactiveCommand.Create(canDismiss).WithSubscription(x => Dismiss());

            GoToAddAccountCommand = ReactiveCommand.Create()
                .WithSubscription(_ => NavigateTo(this.CreateViewModel<NewAccountViewModel>()));

            // Activate immediately since WhenActivated triggers off Did* instead of Will* in iOS
            UpdateAccounts();
            this.WhenActivated(d => UpdateAccounts());
        }
 public BrokeredAuthenticationService(IApplicationRegisterService applicationRegisterService, IEnvironmentService environmentService)
 {
     this.applicationRegisterService = applicationRegisterService;
     this.environmentService = environmentService;
     settings = SettingsManager.ProviderSettings;
     sessionService = SessionsManager.ProviderSessionService;
 }
Ejemplo n.º 23
0
        public ExploreViewModel(ISessionService applicationService)
        {
            ShowRepositoryDescription = applicationService.Account.ShowRepositoryDescriptionInList;

            Title = "Explore";

            var gotoRepository = new Action<RepositoryItemViewModel>(x => {
                var vm = this.CreateViewModel<RepositoryViewModel>();
                vm.RepositoryOwner = x.Owner;
                vm.RepositoryName = x.Name;
                NavigateTo(vm);
            });

            var repositories = new ReactiveList<Octokit.Repository>();
            Repositories = repositories.CreateDerivedCollection(x => 
                new RepositoryItemViewModel(x, true, gotoRepository));

            var users = new ReactiveList<Octokit.User>();
            Users = users.CreateDerivedCollection(x => 
                new UserItemViewModel(x.Login, x.AvatarUrl, false, () => {
                    var vm = this.CreateViewModel<UserViewModel>();
                    vm.Init(x.Login);
                    NavigateTo(vm);
                }));

            this.WhenAnyValue(x => x.SearchFilter)
                .DistinctUntilChanged()
                .Subscribe(_ => {
                    SearchText = string.Empty;
                    users.Clear();
                    repositories.Clear();
                });

            var canSearch = this.WhenAnyValue(x => x.SearchText).Select(x => !string.IsNullOrEmpty(x));
            SearchCommand = ReactiveCommand.CreateAsyncTask(canSearch, async t => {
                try
                {
                    users.Clear();
                    repositories.Clear();

                    if (SearchFilter == SearchType.Repositories)
                    {
                        var request = new Octokit.SearchRepositoriesRequest(SearchText);
                        var response = await applicationService.GitHubClient.Search.SearchRepo(request);
                        repositories.Reset(response.Items);
                    }
                    else if (SearchFilter == SearchType.Users)
                    {
                        var request = new Octokit.SearchUsersRequest(SearchText);
                        var response = await applicationService.GitHubClient.Search.SearchUsers(request);
                        users.Reset(response.Items);
                    }
                }
                catch (Exception e)
                {
                    var msg = string.Format("Unable to search for {0}. Please try again.", SearchFilter.Humanize());
                    throw new Exception(msg, e);
                }
            });
        }
Ejemplo n.º 24
0
 public PhotosController(ISessionService sessionService, IAlbumService albumService, IPhotoService photoService, ITagService tagService)
 {
     this.mSessionService = sessionService;
     this.mAlbumService = albumService;
     this.mPhotoService = photoService;
     this.mTagService = tagService;
 }
Ejemplo n.º 25
0
        public NotificationsViewModel(ISessionService applicationService)
        {
            _applicationService = applicationService;
            Title = "Notifications";
  
            ReadSelectedCommand = ReactiveCommand.Create().WithSubscription(_ =>
            {
                if (GroupedNotifications.SelectMany(x => x.Notifications).All(x => !x.IsSelected))
                {
                    applicationService.Client.ExecuteAsync(applicationService.Client.Notifications.MarkAsRead()).ToBackground();
                    _notifications.Clear();
                }
                else
                {
                    var selected = GroupedNotifications.SelectMany(x => x.Notifications)
                        .Where(x => x.IsSelected && x.Notification.Unread).ToList();

                    var tasks = selected
                        .Select(t =>  _applicationService.GitHubClient.Notification.MarkAsRead(int.Parse(t.Id)));

                    Task.WhenAll(tasks).ToBackground();

                    foreach (var s in selected)
                        _notifications.Remove(s.Notification);
                }
            });

            _notifications.Changed.Select(_ => Unit.Default)
                .Merge(_notifications.ItemChanged.Select(_ => Unit.Default))
                .Subscribe(_ =>
                {
                    GroupedNotifications = _notifications.GroupBy(x => x.Repository.FullName).Select(x => 
                    {
                        var items = x.Select(y => new NotificationItemViewModel(y, GoToNotification));
                        var notifications = new ReactiveList<NotificationItemViewModel>(items);
                        return new NotificationGroupViewModel(x.Key, notifications);
                    }).ToList();
                });


            LoadCommand = ReactiveCommand.CreateAsyncTask(async _ => {
                var all = ActiveFilter == AllFilter;
                var participating = ActiveFilter == ParticipatingFilter;
                var req = new Octokit.NotificationsRequest { All = all, Participating = participating, Since = DateTimeOffset.MinValue };
                var notifications = await applicationService.GitHubClient.Notification.GetAllForCurrent(req);
                _notifications.Reset(notifications);
            });

            LoadCommand
                .Where(_ => ActiveFilter == UnreadFilter)
                .Select(_ => _notifications.Count)
                .Subscribe(_notificationCount.OnNext);

            this.WhenAnyValue(x => x.ActiveFilter).Skip(1).Subscribe(x =>
            {
                _notifications.Clear();
                LoadCommand.ExecuteIfCan();
            });
        }
Ejemplo n.º 26
0
        public SettingsViewModel(ISessionService applicationService, IFeaturesService featuresService, 
            IAccountsRepository accountsService, IEnvironmentalService environmentalService, 
            IPushNotificationRegistrationService pushNotificationsService)
        {
            Title = "Account Settings";

            _sessionService = applicationService;
            _featuresService = featuresService;
            _accountsService = accountsService;
            _environmentService = environmentalService;
            _pushNotificationsService = pushNotificationsService;

            AccountImageUrl = applicationService.Account.AvatarUrl;

            GoToDefaultStartupViewCommand = ReactiveCommand.Create();
            GoToDefaultStartupViewCommand.Subscribe(_ => 
            {
                var vm = this.CreateViewModel<DefaultStartupViewModel>();
                vm.WhenAnyValue(x => x.SelectedStartupView)
                    .Subscribe(x => DefaultStartupViewName = x);
                NavigateTo(vm);
            });

            GoToSyntaxHighlighterCommand = ReactiveCommand.Create().WithSubscription(_ =>
            {
                var vm = this.CreateViewModel<SyntaxHighlighterSettingsViewModel>();
                vm.SaveCommand.Subscribe(__ => SyntaxHighlighter = vm.SelectedTheme);
                NavigateTo(vm);
            });

            DeleteAllCacheCommand = ReactiveCommand.Create();

            GoToSourceCodeCommand = ReactiveCommand.Create().WithSubscription(_ => {
                var vm = this.CreateViewModel<RepositoryViewModel>();
                vm.Init("thedillonb", "codehub");
                NavigateTo(vm);
            });

            ShowOrganizationsInEvents = applicationService.Account.ShowOrganizationsInEvents;
            this.WhenAnyValue(x => x.ShowOrganizationsInEvents).Skip(1).Subscribe(x =>
            {
                applicationService.Account.ShowOrganizationsInEvents = x;
                accountsService.Update(applicationService.Account);
            });

            ExpandOrganizations = applicationService.Account.ExpandOrganizations;
            this.WhenAnyValue(x => x.ExpandOrganizations).Skip(1).Subscribe(x =>
            {
                applicationService.Account.ExpandOrganizations = x;
                accountsService.Update(applicationService.Account);
            });

            ShowRepositoryDescriptionInList = applicationService.Account.ShowRepositoryDescriptionInList;
            this.WhenAnyValue(x => x.ShowRepositoryDescriptionInList).Skip(1).Subscribe(x =>
            {
                applicationService.Account.ShowRepositoryDescriptionInList = x;
                accountsService.Update(applicationService.Account);
            });
        }
Ejemplo n.º 27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceGateway"/> class.
 /// </summary>
 /// <param name="loggerFactory">The logger factory.</param>
 /// <param name="kernel">The kernel.</param>
 /// <param name="sessionService">The session service.</param>
 public ServiceGateway(ILoggerFactory loggerFactory, IKernel kernel, ISessionService sessionService)
 {
     this.kernel = kernel;
     dataProcessor = new Serializer();
     logger = loggerFactory.CreateLogger<ServiceGateway>("Framework");
     this.sessionService = sessionService;
     serializer = new Serializer();
 }
Ejemplo n.º 28
0
 public UserController(IUserService userService,ICryptographyService cryptographyService,IImageService imageService, IEmailService emailService,ISessionService sessionService)
 {
     _userService = userService;
     _cryptographyService = cryptographyService;
     _imageService = imageService;
     _emailService = emailService;
     _sessionService = sessionService;
 }
Ejemplo n.º 29
0
        public GistCreateViewModel(ISessionService sessionService, IAlertDialogFactory alertDialogFactory)
        {
            _sessionService = sessionService;
            _alertDialogFactory = alertDialogFactory;

            Title = "Create Gist";
            IsPublic = true;
        }
Ejemplo n.º 30
0
 public SessionHub(ISessionService services)
 {
     if (null == services)
     {
         throw new ArgumentNullException("services");
     }
     _services = services;
 }
Ejemplo n.º 31
0
 public SpeakerCardViewComponent(ISessionService sessionsService)
 {
     _sessionsService = sessionsService;
 }
Ejemplo n.º 32
0
 protected CoreImageController(ISessionService sessionService)
 {
     this.Session    = sessionService.Session;
     this.ETagByPath = new ConcurrentDictionary <string, string>();
 }
 public BaseSecureController()
 {
     this.session = ObjectFactory.GetInstance <ISessionService>();
 }
 public ManageSessionsModel(ISessionService sessionService)
 {
     _sessionService          = sessionService;
     SessionExpirationMinutes = 1;
 }
Ejemplo n.º 35
0
 public SessionController(ISessionService sessionService)
 {
     _sessionService = sessionService;
 }
Ejemplo n.º 36
0
        public OrganizationViewModel(ISessionService applicationService)
        {
            this.WhenAnyValue(x => x.Organization, x => x.Username,
                              (x, y) => x == null ? y : (string.IsNullOrEmpty(x.Name) ? x.Login : x.Name))
            .Select(x => x ?? "Organization")
            .Subscribe(x => Title = x);

            this.WhenAnyValue(x => x.Organization.AvatarUrl)
            .Select(x => new GitHubAvatar(x))
            .ToProperty(this, x => x.Avatar, out _avatar);

            GoToMembersCommand = ReactiveCommand.Create();
            GoToMembersCommand
            .Select(_ => this.CreateViewModel <OrganizationMembersViewModel>())
            .Select(x => x.Init(Username))
            .Subscribe(NavigateTo);

            GoToTeamsCommand = ReactiveCommand.Create();
            GoToTeamsCommand
            .Select(_ => this.CreateViewModel <TeamsViewModel>())
            .Select(x => x.Init(Username))
            .Subscribe(NavigateTo);

            GoToFollowersCommand = ReactiveCommand.Create();
            GoToFollowersCommand
            .Select(_ => this.CreateViewModel <UserFollowersViewModel>())
            .Select(x => x.Init(Username))
            .Subscribe(NavigateTo);

            GoToFollowingCommand = ReactiveCommand.Create();
            GoToFollowingCommand
            .Select(_ => this.CreateViewModel <UserFollowingsViewModel>())
            .Select(x => x.Init(Username))
            .Subscribe(NavigateTo);

            GoToEventsCommand = ReactiveCommand.Create();
            GoToEventsCommand
            .Select(_ => this.CreateViewModel <UserEventsViewModel>())
            .Select(x => x.Init(Username))
            .Subscribe(NavigateTo);

            GoToGistsCommand = ReactiveCommand.Create();
            GoToGistsCommand
            .Select(_ => this.CreateViewModel <UserGistsViewModel>())
            .Select(x => x.Init(Username))
            .Subscribe(NavigateTo);

            GoToRepositoriesCommand = ReactiveCommand.Create().WithSubscription(_ => {
                var vm = this.CreateViewModel <OrganizationRepositoriesViewModel>();
                vm.Init(Username);
                NavigateTo(vm);
            });

            LoadCommand = ReactiveCommand.CreateAsyncTask(async _ =>
            {
                applicationService.GitHubClient.Organization.Team.GetAll(Username)
                .ToBackground(x => CanViewTeams = true);

                Organization = await applicationService.GitHubClient.Organization.Get(Username);
            });
        }
Ejemplo n.º 37
0
 public EditModel(DatabaseContext context, IMapper mapper, ISessionService sessionService) : base(sessionService)
 {
     _context    = context;
     this.mapper = mapper;
 }
Ejemplo n.º 38
0
 public void Unregister(ISessionService item)
 {
     _sessions[item.Id] = null;
 }
Ejemplo n.º 39
0
 public void Register(ISessionService item)
 {
     _sessions[item.Id] = item;
 }
Ejemplo n.º 40
0
 public bool ShouldClose(ISessionService item)
 {
     return(true);
 }
Ejemplo n.º 41
0
 public ISessionService Remove(ISessionService item)
 {
     return(Remove(item, _previousItem ?? Create()));
 }
Ejemplo n.º 42
0
        public CommitViewModel(ISessionService applicationService, IActionMenuFactory actionMenuService, IAlertDialogFactory alertDialogFactory)
        {
            Title = "Commit";

            var comments = new ReactiveList <CommentModel>();

            Comments = comments.CreateDerivedCollection(x => new CommitCommentItemViewModel(x));

            this.WhenAnyValue(x => x.Commit)
            .Select(x => new GitHubAvatar(x.GenerateGravatarUrl()))
            .ToProperty(this, x => x.Avatar, out _avatar);

            var files = this.WhenAnyValue(x => x.Commit.Files).IsNotNull();

            files.Select(x => x.Count(y => string.Equals(y.Status, "added")))
            .ToProperty(this, x => x.DiffAdditions, out _diffAdditions);

            files.Select(x => x.Count(y => string.Equals(y.Status, "removed")))
            .ToProperty(this, x => x.DiffDeletions, out _diffDeletions);

            files.Select(x => x.Count(y => string.Equals(y.Status, "modified")))
            .ToProperty(this, x => x.DiffModifications, out _diffModifications);

            GoToAddedFiles = ReactiveCommand.Create(this.WhenAnyValue(x => x.DiffAdditions).Select(x => x > 0));
            GoToAddedFiles
            .Select(_ => new CommitFilesViewModel())
            .Select(y => y.Init(RepositoryOwner, RepositoryName, Node, "Added", Commit.Files.Where(x => string.Equals(x.Status, "added"))))
            .Subscribe(NavigateTo);

            GoToRemovedFiles = ReactiveCommand.Create(this.WhenAnyValue(x => x.DiffDeletions).Select(x => x > 0));
            GoToRemovedFiles
            .Select(_ => new CommitFilesViewModel())
            .Select(y => y.Init(RepositoryOwner, RepositoryName, Node, "Removed", Commit.Files.Where(x => string.Equals(x.Status, "removed"))))
            .Subscribe(NavigateTo);

            GoToModifiedFiles = ReactiveCommand.Create(this.WhenAnyValue(x => x.DiffModifications).Select(x => x > 0));
            GoToModifiedFiles
            .Select(_ => new CommitFilesViewModel())
            .Select(y => y.Init(RepositoryOwner, RepositoryName, Node, "Modified", Commit.Files.Where(x => string.Equals(x.Status, "modified"))))
            .Subscribe(NavigateTo);

            GoToAllFiles = ReactiveCommand.Create(this.WhenAnyValue(x => x.Commit.Files).Select(x => x != null));
            GoToAllFiles
            .Select(_ => new CommitFilesViewModel())
            .Select(y => y.Init(RepositoryOwner, RepositoryName, Node, "All Changes", Commit.Files))
            .Subscribe(NavigateTo);

            this.WhenAnyValue(x => x.Commit)
            .IsNotNull()
            .Select(x => x.GenerateCommiterName())
            .ToProperty(this, x => x.CommiterName, out _commiterName);

            this.WhenAnyValue(x => x.Commit)
            .IsNotNull()
            .Select(x => x.Commit.Message ?? string.Empty)
            .Select(x => Emojis.FindAndReplace(x))
            .ToProperty(this, x => x.CommitMessage, out _commitMessage);

            this.WhenAnyValue(x => x.CommitMessage)
            .IsNotNull()
            .Select(x => {
                var firstNewLine = x.IndexOf("\n", StringComparison.Ordinal);
                return(firstNewLine > 0 ? x.Substring(0, firstNewLine) : x);
            })
            .ToProperty(this, x => x.CommitMessageSummary, out _commitMessageSummary);

            GoToHtmlUrlCommand = ReactiveCommand.Create(this.WhenAnyValue(x => x.Commit).Select(x => x != null));
            GoToHtmlUrlCommand
            .Select(_ => this.CreateViewModel <WebBrowserViewModel>())
            .Select(x => x.Init(Commit.HtmlUrl))
            .Subscribe(NavigateTo);

            GoToRepositoryCommand = ReactiveCommand.Create();
            GoToRepositoryCommand.Subscribe(_ => {
                var vm = this.CreateViewModel <RepositoryViewModel>();
                vm.Init(RepositoryOwner, RepositoryName);
                NavigateTo(vm);
            });

            AddCommentCommand = ReactiveCommand.Create().WithSubscription(_ => {
                var vm = new ComposerViewModel(async s => {
                    var request = applicationService.Client.Users[RepositoryOwner].Repositories[RepositoryName].Commits[Node].Comments.Create(s);
                    comments.Add((await applicationService.Client.ExecuteAsync(request)).Data);
                }, alertDialogFactory);
                NavigateTo(vm);
            });

            var validCommitObservable = this.WhenAnyValue(x => x.Commit).Select(x => x != null);

            var copyShaCommand = ReactiveCommand.Create(validCommitObservable)
                                 .WithSubscription(x => actionMenuService.SendToPasteBoard(this.Commit.Sha));

            var shareCommand = ReactiveCommand.Create(validCommitObservable)
                               .WithSubscription(sender => actionMenuService.ShareUrl(sender, this.Commit.HtmlUrl));

            var browseCodeCommand = ReactiveCommand.Create(validCommitObservable)
                                    .WithSubscription(x =>
            {
                var vm             = this.CreateViewModel <SourceTreeViewModel>();
                vm.RepositoryName  = RepositoryName;
                vm.RepositoryOwner = RepositoryOwner;
                vm.Branch          = this.Commit.Sha;
                NavigateTo(vm);
            });

            ShowMenuCommand = ReactiveCommand.CreateAsyncTask(sender => {
                var menu = actionMenuService.Create();
                menu.AddButton("Add Comment", AddCommentCommand);
                menu.AddButton("Copy SHA", copyShaCommand);
                menu.AddButton("Browse Code", browseCodeCommand);
                menu.AddButton("Share", shareCommand);
                menu.AddButton("Show in GitHub", GoToHtmlUrlCommand);
                return(menu.Show(sender));
            });

            LoadCommand = ReactiveCommand.CreateAsyncTask(async t => {
                var commentRequest = applicationService.Client.Users[RepositoryOwner].Repositories[RepositoryName].Commits[Node].Comments.GetAll();
                applicationService.Client.ExecuteAsync(commentRequest).ToBackground(x => comments.Reset(x.Data.Where(y => y.Position.HasValue)));
                Commit = await applicationService.GitHubClient.Repository.Commits.Get(RepositoryOwner, RepositoryName, Node);
            });
        }
Ejemplo n.º 43
0
 public DashboardController(ISessionService sessionService)
 {
     _sessionService = sessionService;
 }
Ejemplo n.º 44
0
 public ItemService(IMapper mapper, ISessionService sessionService, IGameService gameService, IItemRepository itemRepository)
     : base(mapper, sessionService, gameService, itemRepository)
 {
 }
Ejemplo n.º 45
0
        public SignInViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, ISessionService sessionService, ILifetimeService lifecycleService, INotificationsService notificationsService)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            _sessionService       = sessionService;
            _lifetimeService      = lifecycleService;
            _notificationsService = notificationsService;

            SwitchCommand = new RelayCommand(SwitchExecute);
            SendCommand   = new RelayCommand(SendExecute, () => !IsLoading);
            ProxyCommand  = new RelayCommand(ProxyExecute);
        }
Ejemplo n.º 46
0
 private void Update(ISessionService session)
 {
     Items.ReplaceWith(TLContainer.Current.GetSessions());
     ActiveItem = session;
 }
Ejemplo n.º 47
0
 public CertificateRecipientController(ILogger <CertificateController> logger, IHttpContextAccessor contextAccessor,
                                       ICertificateApiClient certificateApiClient, ISessionService sessionService) : base(logger, contextAccessor, certificateApiClient, sessionService)
 {
 }
Ejemplo n.º 48
0
 public ValuesViewModel(ISessionService sessionService)
 {
     this.sessionService = sessionService;
     LoadCommands();
     RegisterForMessages();
 }
Ejemplo n.º 49
0
 public ProfileController(ISessionService sessionService)
 {
     SessionService = sessionService ?? throw new ArgumentNullException(nameof(sessionService));
 }
Ejemplo n.º 50
0
 public UserController(IUserService userService, ISessionService sessionService)
 {
     _userService    = userService;
     _sessionService = sessionService;
 }
 public AuthenticationService(IOptions <AppSettings> appSettings, ISessionService sessionService)
 {
     _appSettings    = appSettings;
     _sessionService = sessionService;
 }
Ejemplo n.º 52
0
 public PedidoDb(IProdutoRepository produtoRepository, IPedidoRepository pedidoRepository, ISessionService sessionService, IItemPedidoRepository itemPedidoRepository, ICadastroRepository cadastroRepository)
 {
     _produtoRepository    = produtoRepository;
     _pedidoRepository     = pedidoRepository;
     _sessionService       = sessionService;
     _itemPedidoRepository = itemPedidoRepository;
     _cadastroRepository   = cadastroRepository;
 }
 public FileChangePipelinePublishChangesStep(ILogger <FileChangePipelinePublishChangesStep> logger,
                                             IClassroomHubClient classroomHubClient, ISessionService sessionService)
 {
     _logger             = logger;
     _classroomHubClient = classroomHubClient;
     _sessionService     = sessionService;
 }
 public UsersController(IAdministratorService administratorService, ICompanyService companyService, IEmployeeService employeeService, ISessionService sessionService)
 {
     this.administratorService = administratorService;
     this.companyService       = companyService;
     this.employeeService      = employeeService;
     this.sessionService       = sessionService;
 }
Ejemplo n.º 55
0
 public PermissionsGroupController(IPermissionsGroupService permissionsGroupService, IAdminsService adminsService,
                                   IPermissionGroupAdminService permissionGroupAdminService, ISessionService sessionService, IMapper mapper
                                   , IConfiguration configuration, ILoggingService loggingService)
 {
     this.permissionsGroupService     = permissionsGroupService;
     this.adminsService               = adminsService;
     this.permissionGroupAdminService = permissionGroupAdminService;
     this.mapper         = mapper;
     this.configuration  = configuration;
     this.loggingService = loggingService;
     this.sessionService = sessionService;
 }
Ejemplo n.º 56
0
 public UploadPictureCommand(IPictureService pictures, IAlbumService albums, ISessionService session)
 {
     this.pictures = pictures;
     this.albums   = albums;
     this.session  = session;
 }
 public SubmitSupportRequestHandler(AskContext context, ILogger <SubmitSupportRequestHandler> logger, IMediator mediator, ISessionService sessionService, IEmailService emailService)
 {
     _context        = context;
     _logger         = logger;
     _mediator       = mediator;
     _sessionService = sessionService;
     _emailService   = emailService;
 }
Ejemplo n.º 58
0
 public AuthController(IAuthService authService, IAuthManager authManager, ISessionService sessionService)
 {
     this.authService    = authService;
     this.authManager    = authManager;
     this.sessionService = sessionService;
 }
Ejemplo n.º 59
0
 public AzureApiService(HttpClient httpHandler, ISessionService sessionService)
 {
     _httpClient     = httpHandler;
     _sessionService = sessionService;
 }
Ejemplo n.º 60
0
 public TestHomeController(ISessionService sessionService)
 {
     this.Session = sessionService.Session;
 }