Ejemplo n.º 1
0
 public ApiRepositoryController(
     IPresentationService presentationService,
     IInteractionService interactionService)
 {
     _presentationService = presentationService;
     _interactionService  = interactionService;
 }
Ejemplo n.º 2
0
        public ModuleController(IEnvironmentService environmentService, IPresentationService presentationService, ShellService shellService,
                                Lazy <FileController> fileController, Lazy <RichTextDocumentController> richTextDocumentController, Lazy <PrintController> printController,
                                Lazy <ShellViewModel> shellViewModel, Lazy <MainViewModel> mainViewModel, Lazy <StartViewModel> startViewModel)
        {
            // Upgrade the settings from a previous version when the new version starts the first time.
            if (Settings.Default.IsUpgradeNeeded)
            {
                Settings.Default.Upgrade();
                Settings.Default.IsUpgradeNeeded = false;
            }

            // Initializing the cultures must be done first. Therefore, we inject the Controllers and ViewModels lazy.
            InitializeCultures();
            presentationService.InitializeCultures();

            this.environmentService         = environmentService;
            this.fileController             = fileController.Value;
            this.richTextDocumentController = richTextDocumentController.Value;
            this.printController            = printController.Value;
            this.shellViewModel             = shellViewModel.Value;
            this.mainViewModel  = mainViewModel.Value;
            this.startViewModel = startViewModel.Value;

            shellService.ShellView       = this.shellViewModel.View;
            this.shellViewModel.Closing += ShellViewModelClosing;
            exitCommand = new DelegateCommand(Close);
        }
Ejemplo n.º 3
0
        public ShellViewModel(IShellView view, IMessageService messageService, IPresentationService presentationService, IShellService shellService,
                              IFileService fileService, ISettingsService settingsService) : base(view)
        {
            this.messageService = messageService;
            ShellService        = shellService;
            FileService         = fileService;
            EnglishCommand      = new DelegateCommand(() => SelectLanguage(new CultureInfo("en-US")));
            GermanCommand       = new DelegateCommand(() => SelectLanguage(new CultureInfo("de-DE")));
            AboutCommand        = new DelegateCommand(ShowAboutMessage);
            settings            = settingsService.Get <AppSettings>();
            view.Closing       += ViewClosing;
            view.Closed        += ViewClosed;

            // Restore the window size when the values are valid.
            if (settings.Left >= 0 && settings.Top >= 0 && settings.Width > 0 && settings.Height > 0 &&
                settings.Left + settings.Width <= presentationService.VirtualScreenWidth &&
                settings.Top + settings.Height <= presentationService.VirtualScreenHeight)
            {
                ViewCore.Left   = settings.Left;
                ViewCore.Top    = settings.Top;
                ViewCore.Height = settings.Height;
                ViewCore.Width  = settings.Width;
            }
            ViewCore.IsMaximized = settings.IsMaximized;
        }
        public NavigationPresenter(INavigationView view,
                                   ISettingsSerializer settingsSerializer,
                                   IKeyboardListener keyboardListener,
                                   IMatchModelMapper matchModelMapper,
                                   IPresentationService presentationService,
                                   INavigationServiceBuilder navigationServiceBuilder)
        {
            _view = view;
            _settingsSerializer       = settingsSerializer;
            _keyboardListener         = keyboardListener;
            _matchModelMapper         = matchModelMapper;
            _navigationServiceBuilder = navigationServiceBuilder;
            _presentationService      = presentationService;

            Settings settings = _settingsSerializer.Deserialize();

            _keyboardListener.KeyCombinationPressed += GlobalKeyCombinationPressed;
            _keyboardListener.StartListening(settings.GlobalKeyCombination);

            _view.CurrentSettings = settings;
            _view.ShowMatches(new List <MatchModel> {
                new MatchModel(_matchModelMapper, Resources.InitialMatchesMessage)
            });
            _view.ShowInitializingScreen = true;

            //Initialize navigation service asynchronously, as it may require a long operation (file system parsing).
            //Clone settings to avoid any coupling
            Settings           settingsCopy = settings.Clone() as Settings;
            InitializeDelegate initialize   = Initialize;

            initialize.BeginInvoke(settingsCopy, EndInitialize, initialize);
        }
Ejemplo n.º 5
0
        public ApplicationController(CompositionContainer container, IPresentationService presentationService,
            IMessageService messageService, ShellService shellService, ProxyController proxyController, DataController dataController)
        {
            InitializeCultures();
            presentationService.InitializeCultures();

            this.container = container;
            this.dataController = dataController;
            this.proxyController = proxyController;
            this.messageService = messageService;

            this.dataService = container.GetExportedValue<IDataService>();

            this.floatingViewModel = container.GetExportedValue<FloatingViewModel>();
            this.mainViewModel = container.GetExportedValue<MainViewModel>();
            this.userBugsViewModel = container.GetExportedValue<UserBugsViewModel>();
            this.teamBugsViewModel = container.GetExportedValue<TeamBugsViewModel>();

            shellService.MainView = mainViewModel.View;
            shellService.UserBugsView = userBugsViewModel.View;
            shellService.TeamBugsView = teamBugsViewModel.View;

            this.floatingViewModel.Closing += FloatingViewModelClosing;

            this.showMainWindowCommand = new DelegateCommand(ShowMainWindowCommandExcute);
            this.englishCommand = new DelegateCommand(() => SelectLanguage(new CultureInfo("en-US")));
            this.chineseCommand = new DelegateCommand(() => SelectLanguage(new CultureInfo("zh-CN")));
            this.settingCommand = new DelegateCommand(SettingDialogCommandExcute, CanSettingDialogCommandExcute);
            this.aboutCommand = new DelegateCommand(AboutDialogCommandExcute);
            this.exitCommand = new DelegateCommand(ExitCommandExcute);
        }
Ejemplo n.º 6
0
        public FloatingViewModel(IFloatingView view, IDataService dataService, IPresentationService presentationService)
            : base(view)
        {
            this.dataService = dataService;
            view.Closing    += ViewClosing;
            view.Closed     += ViewClosed;

            // Restore the window size when the values are valid.
            if (Settings.Default.FloatingWindowLeft >= 0 && Settings.Default.FloatingWindowTop >= 0 &&
                Settings.Default.FloatingWindowLeft + 120 <= presentationService.VirtualScreenWidth &&
                Settings.Default.FloatingWindowTop + 20 <= presentationService.VirtualScreenHeight)
            {
                ViewCore.Left = Settings.Default.FloatingWindowLeft;
                ViewCore.Top  = Settings.Default.FloatingWindowTop;
            }
            else
            {
                ViewCore.Left = presentationService.VirtualScreenWidth - 200;
                ViewCore.Top  = 50;
            }

            if (Settings.Default.FloatingWindowOpacity <= 100 && Settings.Default.FloatingWindowOpacity >= 20)
            {
                Opacity = Settings.Default.FloatingWindowOpacity;
            }
            else
            {
                Opacity = 80;
            }

            AddWeakEventListener(this.dataService.UserBugs, UserBugsCollectionChanged);

            this.setOpacityCommand = new DelegateCommand <byte?>(opacity => SetOpacity(Convert.ToByte(opacity)));
        }
        public NavigationPresenter(INavigationView view,
            ISettingsSerializer settingsSerializer,
            IKeyboardListener keyboardListener,
            IMatchModelMapper matchModelMapper,
            IPresentationService presentationService,
            INavigationServiceBuilder navigationServiceBuilder)
        {
            _view = view;
            _settingsSerializer = settingsSerializer;
            _keyboardListener = keyboardListener;
            _matchModelMapper = matchModelMapper;
            _navigationServiceBuilder = navigationServiceBuilder;
            _presentationService = presentationService;

            Settings settings = _settingsSerializer.Deserialize();

            _keyboardListener.KeyCombinationPressed += GlobalKeyCombinationPressed;
            _keyboardListener.StartListening(settings.GlobalKeyCombination);

            _view.CurrentSettings = settings;
            _view.ShowMatches(new List<MatchModel> {new MatchModel(_matchModelMapper, Resources.InitialMatchesMessage)});
            _view.ShowInitializingScreen = true;

            //Initialize navigation service asynchronously, as it may require a long operation (file system parsing).
            //Clone settings to avoid any coupling
            Settings settingsCopy = settings.Clone() as Settings;
            InitializeDelegate initialize = Initialize;
            initialize.BeginInvoke(settingsCopy, EndInitialize, initialize);
        }
Ejemplo n.º 8
0
        public ApplicationController(CompositionContainer container, IPresentationService presentationService,
                                     IMessageService messageService, ShellService shellService, ProxyController proxyController, DataController dataController)
        {
            InitializeCultures();
            presentationService.InitializeCultures();

            this.container       = container;
            this.dataController  = dataController;
            this.proxyController = proxyController;
            this.messageService  = messageService;

            this.dataService = container.GetExportedValue <IDataService>();

            this.floatingViewModel = container.GetExportedValue <FloatingViewModel>();
            this.mainViewModel     = container.GetExportedValue <MainViewModel>();
            this.userBugsViewModel = container.GetExportedValue <UserBugsViewModel>();
            this.teamBugsViewModel = container.GetExportedValue <TeamBugsViewModel>();

            shellService.MainView     = mainViewModel.View;
            shellService.UserBugsView = userBugsViewModel.View;
            shellService.TeamBugsView = teamBugsViewModel.View;

            this.floatingViewModel.Closing += FloatingViewModelClosing;

            this.showMainWindowCommand = new DelegateCommand(ShowMainWindowCommandExcute);
            this.englishCommand        = new DelegateCommand(() => SelectLanguage(new CultureInfo("en-US")));
            this.chineseCommand        = new DelegateCommand(() => SelectLanguage(new CultureInfo("zh-CN")));
            this.settingCommand        = new DelegateCommand(SettingDialogCommandExcute, CanSettingDialogCommandExcute);
            this.aboutCommand          = new DelegateCommand(AboutDialogCommandExcute);
            this.exitCommand           = new DelegateCommand(ExitCommandExcute);
        }
Ejemplo n.º 9
0
        public ApplicationController(IEnvironmentService environmentService, IPresentationService presentationService, ShellService shellService,
            Lazy<FileController> fileController, Lazy<RichTextDocumentController> richTextDocumentController, Lazy<PrintController> printController,
            Lazy<ShellViewModel> shellViewModel, Lazy<MainViewModel> mainViewModel, Lazy<StartViewModel> startViewModel)
        {
            // Upgrade the settings from a previous version when the new version starts the first time.
            if (Settings.Default.IsUpgradeNeeded)
            {
                Settings.Default.Upgrade();
                Settings.Default.IsUpgradeNeeded = false;
            }

            // Initializing the cultures must be done first. Therefore, we inject the Controllers and ViewModels lazy.
            InitializeCultures();
            presentationService.InitializeCultures();

            this.environmentService = environmentService;
            this.fileController = fileController.Value;
            this.richTextDocumentController = richTextDocumentController.Value;
            this.printController = printController.Value;
            this.shellViewModel = shellViewModel.Value;
            this.mainViewModel = mainViewModel.Value;
            this.startViewModel = startViewModel.Value;

            shellService.ShellView = this.shellViewModel.View;
            this.shellViewModel.Closing += ShellViewModelClosing;
            this.exitCommand = new DelegateCommand(Close);
        }
Ejemplo n.º 10
0
 public BigBlueButtonFacade(IFileDownloader fileDownloader,
                            IVideoService videoService, IPresentationService presentationService)
 {
     _fileDownloader      = fileDownloader;
     _videoService        = videoService;
     _presentationService = presentationService;
 }
Ejemplo n.º 11
0
        public ShellViewModel(IShellView view, IMessageService messageService, IPresentationService presentationService, IShellService shellService, IFileService fileService)
            : base(view)
        {
            this.messageService = messageService;
            this.ShellService   = shellService;
            this.FileService    = fileService;
            this.englishCommand = new DelegateCommand(() => SelectLanguage(new CultureInfo("en-US")));
            this.germanCommand  = new DelegateCommand(() => SelectLanguage(new CultureInfo("de-DE")));
            this.aboutCommand   = new DelegateCommand(ShowAboutMessage);

            view.Closing += ViewClosing;
            view.Closed  += ViewClosed;

            // Restore the window size when the values are valid.
            if (Settings.Default.Left >= 0 && Settings.Default.Top >= 0 && Settings.Default.Width > 0 && Settings.Default.Height > 0 &&
                Settings.Default.Left + Settings.Default.Width <= presentationService.VirtualScreenWidth &&
                Settings.Default.Top + Settings.Default.Height <= presentationService.VirtualScreenHeight)
            {
                ViewCore.Left   = Settings.Default.Left;
                ViewCore.Top    = Settings.Default.Top;
                ViewCore.Height = Settings.Default.Height;
                ViewCore.Width  = Settings.Default.Width;
            }
            ViewCore.IsMaximized = Settings.Default.IsMaximized;
        }
Ejemplo n.º 12
0
        public ShellViewModel(IPresentationService presentationService,
                              IShellSettingsService shellSettingsService,
                              IEventAggregator eventAggregator,
                              IMenuViewModel menu,
                              ISettingsViewModel settings,
                              ICodeGenSettingsService codeGenSettingsService,
                              ICodeGenSettings codeGenSettings,
                              IMessageService messageService,
                              IMappingViewModel mapping,
                              ISchemaService schemaService,
                              ICustomSchemaSqlViewModel customSchemaSqlViewModel,
                              ITemplateWriterService templateWriterService)
        {
            this._shellSettingsService   = shellSettingsService;
            this._codeGenSettingsService = codeGenSettingsService;
            this._codeGenSettings        = codeGenSettings;
            this._messageService         = messageService;
            this._templateWriterService  = templateWriterService;
            this.Menu                     = menu;
            this.Settings                 = settings;
            this.Mapping                  = mapping;
            this._schemaService           = schemaService;
            this.CustomSchemaSqlViewModel = customSchemaSqlViewModel;
            this.WindowClosing            = new Command <CancelEventArgs>(OnWindowClosing);
            this.WindowDrop               = new Command <DragEventArgs>(OnWindowDrop);

            this.DisplayText = "IQToolkit CodeGen";
            this.SetWindowPosition(presentationService);

            eventAggregator.GetEvent <LoadSchemaEvent>().Subscribe(this.LoadSchemaEventHandler);
            eventAggregator.GetEvent <GenerateFilesEvent>().Subscribe(_ => this.GenerateFilesEventHandler());
            eventAggregator.GetEvent <CustomSchemaSqlViewVisibilityChangedEvent>().Subscribe(this.CustomSchemaSqlViewVisibilityChangedEvent);
        }
        public PresentationController(IOptions <AppSettings> options, IPresentationService presentationService,
                                      ISlideService slideService) : base(options)
        {
            DependencyHelper.ThrowIfNull(presentationService, slideService);

            _presentationService = presentationService;
            _slideService        = slideService;
        }
Ejemplo n.º 14
0
        public PresentationPage()
        {
            this.InitializeComponent();

            _presentationService = NinjectContainer.Resolve <IPresentationService>();
            _httpService         = NinjectContainer.Resolve <IHttpService>();

            PresentationsList = _presentationService.Read();
        }
        public PresentationViewModel(INavigation navigation, IPresentationService presentationService, IErrorHandler errorHandler, IMessageBus messageBus)
        {
            _presentationService = presentationService;
            _errorHandler        = errorHandler;

            NextCommand     = new Command(ExecuteNext);
            PreviousCommand = new Command(ExecutePrevious);
            messageBus.Subscribe <int>(OnErrorOccurred);
        }
Ejemplo n.º 16
0
        public App()
        {
            _presentationService = new PresentationService();
            _signalRService      = new SignalRService();
            GC.KeepAlive(new ChannelBackgroundService(_presentationService, _signalRService));

            // The initial start of the signalR service.  Start/stop will later be invoked by UI control only.
            _signalRService.StartAsync().ConfigureAwait(false);
        }
        public ChannelBackgroundService(IPresentationService presentationService, ISignalRService signalRService)
        {
            _presentationService = presentationService;
            _signalRService      = signalRService;

            presentationService.SlideCountChanged    += OnSlideCountChanged;
            presentationService.SlidePositionChanged += OnSlidePositionChanged;

            signalRService.Started += OnConnectionStarted;
        }
Ejemplo n.º 18
0
        public void InitEventFilter()
        {
            _feedService         = ((App)Application.Current).AppContainer.Resolve <IFeedService>();
            _presentationService = ((App)Application.Current).AppContainer.Resolve <IPresentationService>();

            filterControlContainer.Children.Clear();

            // Event
            var eventNameFilterControl = new FilterSelectors(FilterType.Event, _feedService.GetEvents().ToList());

            eventNameFilterControl.FilterChanged += FilterChanged;
            filterControlContainer.Children.Add(eventNameFilterControl);
        }
Ejemplo n.º 19
0
        public ModuleController(IMessageService messageService, IPresentationService presentationService, 
            IEntityController entityController, BookController bookController, PersonController personController, 
            ShellService shellService, Lazy<ShellViewModel> shellViewModel)
        {
            presentationService.InitializeCultures();

            this.messageService = messageService;
            this.entityController = entityController;
            this.bookController = bookController;
            this.personController = personController;
            this.shellService = shellService;
            this.shellViewModel = shellViewModel;
            this.exitCommand = new DelegateCommand(Close);
        }
Ejemplo n.º 20
0
        public ShellController(IMessageService messageService, IPresentationService presentationService, IEntityController entityController, CountryController countryController, ProvinceController provinceController, CityController cityController,
                               IViewService viewService, Lazy <ShellViewModel> shellViewModel)
        {
            presentationService.InitializeCultures();

            _messageService     = messageService;
            _entityController   = entityController;
            _countryController  = countryController;
            _provinceController = provinceController;
            _cityController     = cityController;
            _viewService        = viewService;
            _shellViewModel     = shellViewModel;
            _exitCommand        = new DelegateCommand(Close);
        }
Ejemplo n.º 21
0
        public ModuleController(IMessageService messageService, IPresentationService presentationService,
                                IEntityController entityController, BookController bookController, PersonController personController,
                                ShellService shellService, Lazy <ShellViewModel> shellViewModel)
        {
            presentationService.InitializeCultures();

            this.messageService   = messageService;
            this.entityController = entityController;
            this.bookController   = bookController;
            this.personController = personController;
            this.shellService     = shellService;
            this.shellViewModel   = shellViewModel;
            this.exitCommand      = new DelegateCommand(Close);
        }
        public ApplicationController(CompositionContainer container, IMessageService messageService, IPresentationService presentationService,
            ShellService shellService, ShellViewModel shellViewModel, MessageListViewModel msgListViewModel,
            AboutBoxViewModel abViewModel)
        {
            presentationService.InitializeCultures();
            this.container = container;
            this.messageService = messageService;
            this.shellService = shellService;
            this.shellViewModel = shellViewModel;
            this.msgListViewModel = msgListViewModel;
            this.abViewModel = abViewModel;
            shellService.ShellView = shellViewModel.View;
            exitCommand = new DelegateCommand(Close);

            msgQueue = new Queue<MessageItem>();
        }
Ejemplo n.º 23
0
        public NavigationWindow(IPresentationService presentationService)
        {
            InitializeComponent();

            _presentationService = presentationService;

            _viewModel = new NavigationModel(_presentationService);
            _viewModel.SearchTextChanged += HandleSearchTextChanged;
            DataContext = _viewModel;

            _delayTimer          = new DispatcherTimer();
            _delayTimer.Interval = TimeSpan.FromMilliseconds(DelayInMilliseconds);
            _delayTimer.Tick    += HandleDelayElapsed;

            HideView();
        }
        public ApplicationController(CompositionContainer container, IEnvironmentService environmentService,
            IPresentationService presentationService, ShellService shellService, FileController fileController)
        {
            InitializeCultures();
            presentationService.InitializeCultures();

            this.environmentService = environmentService;
            this.fileController = fileController;

            this.solutionDocumentController = container.GetExportedValue<SolutionDocumentController>();
            this.shellViewModel = container.GetExportedValue<ShellViewModel>();
            this.mainViewModel = container.GetExportedValue<MainViewModel>();
            this.startViewModel = container.GetExportedValue<StartViewModel>();

            shellService.ShellView = shellViewModel.View;
            this.shellViewModel.Closing += ShellViewModelClosing;
            this.exitCommand = new DelegateCommand(Close);
        }
Ejemplo n.º 25
0
        public ShellViewModel(IShellView shellView, IMessageService messageService, IPresentationService presentationService, IViewService viewService) : base(shellView)
        {
            _messageService    = messageService;
            _viewService       = viewService;
            _aboutCommand      = new DelegateCommand(About_OnExecute);
            shellView.Closing += OnViewClosing;
            shellView.Closed  += OnViewClosed;

            if (AppSettings.Default.Left >= 0 && AppSettings.Default.Top >= 0 && AppSettings.Default.Width > 0 && AppSettings.Default.Height > 0 && AppSettings.Default.Left + AppSettings.Default.Width <= presentationService.VirtualScreenWidth &&
                AppSettings.Default.Top + AppSettings.Default.Height <= presentationService.VirtualScreenHeight)
            {
                ViewCore.Left   = AppSettings.Default.Left;
                ViewCore.Top    = AppSettings.Default.Top;
                ViewCore.Height = AppSettings.Default.Height;
                ViewCore.Width  = AppSettings.Default.Width;
            }

            ViewCore.IsMaximized = AppSettings.Default.IsMaximized;
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Creates a new instance of Program class.
        /// </summary>
        private Program()
        {
            /* get essential commanding services */
            this.presentation = Engine.GetService(typeof(IPresentationService)) as IPresentationService;
            this.game = Engine.GetService(typeof(IGameService)) as IGameService;

            /* no service, no game */
            if ((this.presentation == null) || (this.game == null))
            {
                throw new InvalidOperationException();
            }

            /* show a simple splash screen */
            SplashScreen splashScreen = new SplashScreen();
            splashScreen.FormClosed += new FormClosedEventHandler(OnSplashScreenFormClosed);

            /* show splash */
            this.MainForm = splashScreen;
        }
        public MainWindow(ConnectionDetailView connectionDetailView,
                          ChannelUsersView channelUsersView,
                          ChannelControlsView channelControlsView,
                          IRegionManager regionManager,
                          ISignalRService signalRService,
                          IPresentationService presentationService)
        {
            _connectionDetailView = connectionDetailView;
            _channelUsersView     = channelUsersView;
            _channelControlsView  = channelControlsView;
            _regionManager        = regionManager;
            _signalRService       = signalRService;
            _presentationService  = presentationService;

            InitializeComponent();

            Loaded  += OnLoaded;
            Closing += OnClosing;
        }
Ejemplo n.º 28
0
        public ApiHandler(
            IPresentationService presentationService,
            IInteractionService interactionService,
            ILogger <ApiHandler <TEntity, TDatabaseEntity, TRepository> > logger)
        {
            _presentationService = presentationService;
            _interactionService  = interactionService;
            _logger = logger;
            _jsonSerializerSettings = new JsonSerializerSettings();

            if (Activator.CreateInstance(typeof(EntityModelJsonConverter <>).MakeGenericType(typeof(TEntity))) is JsonConverter jsonConverter)
            {
                _jsonSerializerSettings.Converters.Add(jsonConverter);
            }
            else
            {
                throw new InvalidOperationException($"Could not create {nameof(EntityModelJsonConverter<IEntity>)} for {typeof(TEntity).Name}");
            }
        }
Ejemplo n.º 29
0
        public ShellViewModel(IShellView view, IMessageService messageService, IPresentationService presentationService,
                              IShellService shellService) : base(view)
        {
            this.messageService = messageService;
            ShellService        = shellService;
            aboutCommand        = new DelegateCommand(ShowAboutMessage);
            view.Closing       += ViewClosing;
            view.Closed        += ViewClosed;

            // Restore the window size when the values are valid.
            if (Settings.Default.Left >= 0 && Settings.Default.Top >= 0 && Settings.Default.Width > 0 && Settings.Default.Height > 0 &&
                Settings.Default.Left + Settings.Default.Width <= presentationService.VirtualScreenWidth &&
                Settings.Default.Top + Settings.Default.Height <= presentationService.VirtualScreenHeight)
            {
                ViewCore.Left   = Settings.Default.Left;
                ViewCore.Top    = Settings.Default.Top;
                ViewCore.Height = Settings.Default.Height;
                ViewCore.Width  = Settings.Default.Width;
            }
            ViewCore.IsMaximized = Settings.Default.IsMaximized;
        }
Ejemplo n.º 30
0
        public ApplicationController(CompositionContainer container, IPresentationService presentationService,
                                     ShellService shellService, DataController dataController, NewItemsController newItemsController)
        {
            InitializeCultures();
            presentationService.InitializeCultures();

            this.container          = container;
            this.dataController     = dataController;
            this.newItemsController = newItemsController;
            this.shellViewModel     = container.GetExportedValue <ShellViewModel>();
            this.itemListViewModel  = container.GetExportedValue <ItemListViewModel>();
            this.newItemsViewModel  = container.GetExportedValue <NewItemsViewModel>();

            shellService.ShellView       = shellViewModel.View;
            shellService.ItemListView    = itemListViewModel.View;
            shellService.NewItemsView    = newItemsViewModel.View;
            this.shellViewModel.Closing += ShellViewModelClosing;
            this.exitCommand             = new DelegateCommand(Close);
            this.settingCommand          = new DelegateCommand(SettingDialogCommand);
            this.aboutCommand            = new DelegateCommand(AboutDialogCommand);
        }
Ejemplo n.º 31
0
        private async void OnFirstMessage(object sender, MessageEventArgs e)
        {
            using (var scope = _serviceScopeFactory.CreateScope())
            {
                IUserService         userService         = scope.ServiceProvider.GetRequiredService <IUserService>();
                IPresentationService presentationService = scope.ServiceProvider.GetRequiredService <IPresentationService>();
                User user = await userService.GetByTelegramId(e.Message.From.Username);

                string responseText;
                if (user != null)
                {
                    var presentations = await presentationService.GetByUser(user.UserName);

                    List <InlineKeyboardButton> buttons = new List <InlineKeyboardButton>();

                    if (presentations != null)
                    {
                        responseText = "Hello, " + user.UserName + ", here are your presentations. Please select one to stream.";

                        foreach (var presentation in presentations)
                        {
                            InlineKeyboardButton button = new InlineKeyboardButton();
                            button.CallbackData = $"{user.UserName}:{presentation}:{0}";
                            button.Text         = presentation.Name;
                        }

                        InlineKeyboardMarkup markup = new InlineKeyboardMarkup(buttons);
                        await _client.SendTextMessageAsync(user.UserName, responseText, replyMarkup : markup);
                    }
                    else
                    {
                        responseText = "Hello, " + user.UserName + ", you have no presentations currently in the system. Do you want to add one?. Send one!";
                    }
                }
                else
                {
                    responseText = "It looks, like you are not registered in the system.";
                }
            }
        }
Ejemplo n.º 32
0
        private void SetWindowPosition(IPresentationService presentationService)
        {
            if (this._shellSettingsService.Left >= 0 &&
                this._shellSettingsService.Top >= 0 &&
                this._shellSettingsService.Width > 0 &&
                this._shellSettingsService.Height > 0 &&
                this._shellSettingsService.Left + this._shellSettingsService.Width <= presentationService.VirtualScreenWidth &&
                this._shellSettingsService.Top + this._shellSettingsService.Height <= presentationService.VirtualScreenHeight)
            {
                this.Left   = this._shellSettingsService.Left;
                this.Top    = this._shellSettingsService.Top;
                this.Height = this._shellSettingsService.Height;
                this.Width  = this._shellSettingsService.Width;
            }
            else
            {
                this.Height = presentationService.PrimaryScreenHeight / 2;
                this.Width  = presentationService.PrimaryScreenWidth / 2;
                this.Top    = (presentationService.PrimaryScreenHeight - this.Height) / 2;
                this.Left   = (presentationService.PrimaryScreenWidth - this.Width) / 2;
            }

            this.WindowState = this._shellSettingsService.WindowState;
        }
 public QuestionsController(IQuestionService questionService, IPresentationService presentationService)
 {
     _questionService     = questionService;
     _presentationService = presentationService;
 }
Ejemplo n.º 34
0
 public Program(IBusinessLogicService business, IDataSourceConnectionService dataSource, IPresentationService presentation)
 {
     Business     = business;
     DataSource   = dataSource;
     Presentation = presentation;
 }
 public NavigationModel(IPresentationService presentationService)
 {
     _presentationService = presentationService;
 }
Ejemplo n.º 36
0
        public MainViewModel(IMainView view, IDataService dataService, IShellService shellService, IPresentationService presentationService)
            : base(view)
        {
            this.shellService = shellService;
            this.dataService  = dataService;
            view.Closing     += ViewClosing;
            view.Closed      += ViewClosed;

            // Restore the window size when the values are valid.
            if (Settings.Default.MainWindowLeft >= 0 && Settings.Default.MainWindowTop >= 0 && Settings.Default.MainWindowWidth > 0 && Settings.Default.MainWindowHeight > 0 &&
                Settings.Default.MainWindowLeft + Settings.Default.MainWindowWidth <= presentationService.VirtualScreenWidth &&
                Settings.Default.MainWindowTop + Settings.Default.MainWindowHeight <= presentationService.VirtualScreenHeight)
            {
                ViewCore.Left   = Settings.Default.MainWindowLeft;
                ViewCore.Top    = Settings.Default.MainWindowTop;
                ViewCore.Height = Settings.Default.MainWindowHeight;
                ViewCore.Width  = Settings.Default.MainWindowWidth;
            }

            this.IsShutDown = false;
        }
Ejemplo n.º 37
0
 public TvShowController(IPresentationService presentationService,
                         IOptions <ApplicationSettings> applicationSettings)
 {
     _presentationService = presentationService;
     _applicationSettings = applicationSettings?.Value ?? throw new ArgumentNullException(nameof(applicationSettings));
 }
Ejemplo n.º 38
0
 public DataController(IPresentationService presentationsService, IHostingEnvironment hostingEnvironment)
 {
     _presentationsService = presentationsService;
     _hostingEnvironment   = hostingEnvironment;
 }