async void LogIn() { if (_blocked) { return; } _blocked = true; try { var result = await LogIn(Login, Password); if (result != null) { Ninject.Bind <AuthenticationData>().ToConstant(result); DialogResult = DialogResult.OK; } else { throw new Exception("Неудалось подключиться к серверу. Неверное имя пользователя или пароль"); } } catch (Exception exc) { DialogMessages.Error(exc.Message); } _blocked = false; }
void InitPages() { if (IsBibliographer) { Ninject.Bind <PublishersPage>().ToMethod(method => new PublishersPage(new PageParameters() { RibbonPage = rpPublishers, TabPage = xtpPublishers, GridControl = gcPublishers })); Ninject.Bind <RubricsPage>().ToMethod(method => new RubricsPage(new PageParameters() { RibbonPage = rpRubrics, TabPage = xtpRubrics, GridControl = gcRubrics })); Ninject.Bind <BookPage>().ToMethod(method => new BookPage(new BookPage.BookPageParameters() { RibbonPage = rpBooks, TabPage = xtpBooks, GridControl = gcBooks, RubricItem = beiRubric, PublisherItem = beiPublisher, SearchItem = beiSearch, AuthorsButton = bbiAuthors, AuthorItem = beiAuthor })); Ninject.Bind <AuthorPage>().ToMethod(method => new AuthorPage(new PageParameters() { RibbonPage = rpAuthors, TabPage = xtpAuthors, GridControl = gcAuthors, })); Pages.AddRange(new IPage[] { Ninject.Get <PublishersPage>(), Ninject.Get <RubricsPage>(), Ninject.Get <BookPage>(), Ninject.Get <AuthorPage>(), }); } if (IsOperator) { Ninject.Bind <RequestPage>().ToMethod(method => new RequestPage(new RequestPage.RequestPageParameters() { RibbonPage = rpRequests, TabPage = xtpRequests, GridControl = gcRequests, RenewItem = bbiRenewal, ReturnItem = bbiReturn, SendNotificationsItem = bbiSendNotifications, GridViewApprovedRequests = gvApprovedRequests, GridViewRejectedRequests = gvRejectedRequests, SearchItem = beiSearch })); Ninject.Bind <ReaderPage>().ToMethod(method => new ReaderPage(new ReaderPage.ReaderPageParameters() { RibbonPage = rpReaders, TabPage = xtpReaders, GridControl = gcReaders, RenewCardItem = bbiRenewCard })); Pages.AddRange(new IPage[] { Ninject.Get <RequestPage>(), Ninject.Get <ReaderPage>() }); } if (IsChief) { Ninject.Bind <ReportBookPage>().ToMethod(method => new ReportBookPage(new ReportBookPage.ReportBookPageParameters() { RibbonPage = rpReportBooks, TabPage = xtpReportBooks, GridControl = gcReportBooks, PublisherItem = beiPublisher, RubricItem = beiRubric, SearchItem = beiSearch, ObligatorsItem = bciObligators })); Pages.AddRange(new IPage[] { Ninject.Get <ReportBookPage>() }); } xtcPages.ShowTabHeader = DefaultBoolean.False; xtcPages.TabPages.Clear(); rcPages.Pages.Clear(); foreach (var page in Pages) { xtcPages.TabPages.Add(page.TabPage); rcPages.Pages.Add(page.RibbonPage); } SelectedPage = Pages.FirstOrDefault().Do(a => a.Activate()); }
protected override void ConfigureApplicationContainer(Ninject.IKernel container) { container.Bind<IDocumentSession>().ToMethod(c => DocumentSession.Invoke()); }
protected override void ConfigureApplicationContainer(Ninject.IKernel existingContainer) { base.ConfigureApplicationContainer(existingContainer); existingContainer.Bind<AppSettings>().To<AppSettings>().InSingletonScope(); }