本文整理汇总了C#中ISessionService类的典型用法代码示例。如果您正苦于以下问题:C# ISessionService类的具体用法?C# ISessionService怎么用?C# ISessionService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISessionService类属于命名空间,在下文中一共展示了ISessionService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SessionRequestService
public SessionRequestService(IUnitOfWork uow, Lazy<INotificationService> notificationService, ISessionService sessionService)
{
_sessionService = sessionService;
_notificationService = notificationService;
_uow = uow;
_sessionRequest = uow.Set<SessionRequest>();
}
示例2: IdentityService
public IdentityService(ILearnWithQBUow uow, IEncryptionService encryptionService, ISessionService sessionService, ICacheProvider cacheProvider)
: base(cacheProvider)
{
this.uow = uow;
this.sessionService = sessionService;
this.encryptionService = encryptionService;
}
示例3: ExploreViewModel
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);
}
});
}
示例4: PullRequestsViewModel
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();
});
}
示例5: CreateFileViewModel
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());
}
示例6: FeedbackComposerViewModel
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());
}
示例7: ReadmeViewModel
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);
});
}
示例8: UserGistsViewModel
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";
});
}
示例9: BaseUsersViewModel
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());
});
}
示例10: OrganizationRepositoriesViewModel
public OrganizationRepositoriesViewModel(ISessionService applicationService)
: base(applicationService)
{
_applicationService = applicationService;
this.WhenAnyValue(x => x.Name).Subscribe(x => Title = x ?? "Repositories");
ShowRepositoryOwner = false;
}
示例11: AccountsViewModel
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());
}
示例12: PullRequestRepository
public PullRequestRepository(ISessionService sessionService, string repositoryOwner, string repositoryName, int id)
{
_sessionService = sessionService;
RepositoryOwner = repositoryOwner;
RepositoryName = repositoryName;
Id = id;
}
示例13: MainViewModel
/// <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);
}
});
}
示例14: BugsController
public BugsController(ISessionService sessionService, IFindBugsByUserEmail findByUserEmail, ICreateNewBug createNewBug, IRemoveBug removeBug)
{
this.sessionService = sessionService;
this.findByUserEmail = findByUserEmail;
this.createNewBug = createNewBug;
this.removeBug = removeBug;
}
示例15: CreateFileViewModel
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());
}