/// <summary> /// Calculates the current text's area within the given caption bounds. /// </summary> public Rectangle CalculateTextBounds(Rectangle captionBounds, ICharacterStyle characterStyle, IParagraphStyle paragraphStyle, IDisplayService displayService) { Rectangle textBounds = Rectangle.Empty; Debug.Assert(characterStyle != null); Debug.Assert(paragraphStyle != null); // measure the text size //if (float.IsNaN(dpiY)) dpiY = gfx.DpiY; if (displayService != null) { textBounds.Size = TextMeasurer.MeasureText(displayService.InfoGraphics, string.IsNullOrEmpty(captionText) ? "Ig" : captionText, ToolCache.GetFont(characterStyle), captionBounds.Size, paragraphStyle); } else textBounds.Size = TextMeasurer.MeasureText(string.IsNullOrEmpty(captionText) ? "Ig" : captionText, ToolCache.GetFont(characterStyle), captionBounds.Size, paragraphStyle); // clip text bounds if too large if (textBounds.Width > captionBounds.Width) textBounds.Width = captionBounds.Width; if (textBounds.Height > captionBounds.Height) textBounds.Height = captionBounds.Height; // set horizontal alignment switch (paragraphStyle.Alignment) { case ContentAlignment.BottomLeft: case ContentAlignment.MiddleLeft: case ContentAlignment.TopLeft: textBounds.X = captionBounds.X; break; case ContentAlignment.BottomCenter: case ContentAlignment.MiddleCenter: case ContentAlignment.TopCenter: textBounds.X = captionBounds.X + (int)Math.Round((captionBounds.Width - textBounds.Width) / 2f); break; case ContentAlignment.BottomRight: case ContentAlignment.MiddleRight: case ContentAlignment.TopRight: textBounds.X = captionBounds.Right - textBounds.Width; break; default: Debug.Assert(false, "Unhandled switch case"); break; } // set vertical alignment switch (paragraphStyle.Alignment) { case ContentAlignment.BottomCenter: case ContentAlignment.BottomLeft: case ContentAlignment.BottomRight: textBounds.Y = captionBounds.Bottom - textBounds.Height; break; case ContentAlignment.MiddleCenter: case ContentAlignment.MiddleLeft: case ContentAlignment.MiddleRight: textBounds.Y = captionBounds.Top + (int)Math.Round((captionBounds.Height - textBounds.Height) / 2f); break; case ContentAlignment.TopCenter: case ContentAlignment.TopLeft: case ContentAlignment.TopRight: textBounds.Y = captionBounds.Top; break; default: Debug.Assert(false, "Unhandled switch case"); break; } return textBounds; }
public ViewModel(IExrinContainer exrinContainer, IVisualState visualState, [CallerFilePath] string caller = nameof(ViewModel)) { if (exrinContainer == null) throw new ArgumentNullException(nameof(IExrinContainer)); _applicationInsights = exrinContainer.ApplicationInsights; _displayService = exrinContainer.DisplayService; _navigationService = exrinContainer.NavigationService; _errorHandlingService = exrinContainer.ErrorHandlingService; VisualState = visualState; if (VisualState != null) Task.Run(() => visualState.Init()) .ContinueWith((task) => { if (task.Exception != null) _applicationInsights.TrackException(task.Exception); }); Execution = new Execution() { HandleTimeout = TimeoutHandle, NotifyOfActivity = NotifyActivity, NotifyActivityFinished = NotifyActivityFinished, HandleResult = HandleResult }; }
public ViewModel(IExrinContainer exrinContainer, IVisualState visualState, [CallerFilePath] string caller = nameof(ViewModel)) { if (exrinContainer == null) { throw new ArgumentNullException(nameof(IExrinContainer)); } _applicationInsights = exrinContainer.ApplicationInsights; _displayService = exrinContainer.DisplayService; _navigationService = exrinContainer.NavigationService; _errorHandlingService = exrinContainer.ErrorHandlingService; VisualState = visualState; if (VisualState != null) { Task.Run(() => visualState.Init()) .ContinueWith((task) => { if (task.Exception != null) { _applicationInsights.TrackException(task.Exception); } }); } Execution = new Execution() { HandleTimeout = TimeoutHandle, NotifyOfActivity = NotifyActivity, NotifyActivityFinished = NotifyActivityFinished, HandleResult = HandleResult }; }
public RoomSelectorPage() { InitializeComponent(); logic = new RoomSelectorPageLogic(); displayService = DependencyService.Get <IDisplayService>(DependencyFetchTarget.GlobalInstance); //Fetches the global instance of the dependency service. Even though it should not create more dialog objects. But it saves memory }
public MainViewModel(IMediaEngineFacade engine, ControlPanelViewModel controlViewModel, IFileSelector fileSelector, IDialogService dialogService, ISettingsProvider settingsProvider, IImageCreaterFactory imageCreaterFactory, IDisplayService displayService, IFailedStreamsContainer failedStreamsContainer, ICursorManager cursorManager) { _engine = engine; _controlViewModel = controlViewModel; _fileSelector = fileSelector; _dialogService = dialogService; _settingsProvider = settingsProvider; _imageCreaterFactory = imageCreaterFactory; _displayService = displayService; _failedStreamsContainer = failedStreamsContainer; _cursorManager = cursorManager; _settingsProvider.SettingChanged += _settingsProvider_SettingChanged; ReadSettings(); Messenger.Default.Register <PropertyChangedMessageBase>(this, true, OnPropertyChanged); Messenger.Default.Register <EventMessage>(this, true, OnEventMessage); Messenger.Default.Register <PlayNewFileMessage>(this, true, OnPlayNewFile); Messenger.Default.Register <PlayDiscMessage>(this, true, OnPlayDisc); PackUpCommandBag(); }
public ScheduleViewModel( IModelMapper <ScheduleSubject, ScheduleSubjectItemModel> scheduleItemsMapper, IModelMapper <WeekDayCore, WeekDayModel> weekDaysMapper, IModelMapper <DayOfWeek, WeekDayModel> dayOfWeekMapper, IScheduleRepository scheduleRepository, IWorkerController workerManager, IDisplayService displayService) { _scheduleItemsMapper = scheduleItemsMapper ?? throw new ArgumentNullException(nameof(scheduleItemsMapper)); _scheduleRepository = scheduleRepository ?? throw new ArgumentNullException(nameof(scheduleRepository)); _dayOfWeekMapper = dayOfWeekMapper ?? throw new ArgumentNullException(nameof(dayOfWeekMapper)); _weekDaysMapper = weekDaysMapper ?? throw new ArgumentNullException(nameof(weekDaysMapper)); _workerController = workerManager ?? throw new ArgumentNullException(nameof(workerManager)); _displayService = displayService ?? throw new ArgumentNullException(nameof(displayService)); ScheduleItems = new ObservableCollection <ScheduleSubjectItemModel>(); _selectedWeekDay = WeekDayModel.Undefined; WeekDaySelectCommand = new RelayCommand(o => WeekDaySelect((WeekDayModel)o)); ScheduleItemClickedCommand = new RelayCommand(o => { if ((ScheduleSubjectItemModel)o != null) { var selectedScheduleItem = (ScheduleSubjectItemModel)o; _displayService.ShowDialog <RegistrationWindowViewModel, ScheduleSubjectModel, object>(selectedScheduleItem.Item); } }); }
public ImageViewModel(IDisplayService displayService) { _displayService = displayService; CloseCommand = new RelayCommand <Window>(OnClose); ToggleMaximizeWindowCommand = new RelayCommand <Window>(OnToggleMaximizeWindow); SetExTransparentCommand = new RelayCommand <Window>(OnSetExTransparent); }
public NavigationService(IViewService viewService, INavigationState state, IInjectionProxy injection, IDisplayService displayService) { _viewService = viewService; _state = state; _displayService = displayService; _injection = injection; }
public static void ShowPopup(this IDisplayService displayService, string popupKey, string callbackKey, Action <string> callback) { Dictionary <string, Action <string> > callbacks = new Dictionary <string, Action <string> >(); callbacks.Add(callbackKey, callback); ShowPopup(displayService, popupKey, callbacks); }
/// <summary> /// Constructor /// </summary> /// <param name="transactionDataProviderService">Data provider service implemenation</param> /// <param name="transactionFeeCalculator">Transaction fee calculator implementation</param> /// <param name="displayService">Display service implementation</param> public MerchantFeeCalculator(ITransactionDataProviderService transactionDataProviderService, ITransactionFeeCalculator transactionFeeCalculator, IDisplayService displayService) { _transactionDataProviderService = transactionDataProviderService; _transactionFeeCalculator = transactionFeeCalculator; _displayService = displayService; }
/* * Initialize new instance of AtmController(IDisplayService, IInputService). */ /// <summary> /// Initializes a new instance of the /// <see cref="AtmController(IDisplayService, IInputService)"/> class. /// </summary> public AtmController( IDisplayService displayService, IInputService inputService) { _displayService = displayService; _inputService = inputService; _possibilities = new List <int[]>(); }
public Application( IWorldFactory worldFactory, IParserService parserService, IDisplayService displayService) { _worldFactory = worldFactory; _parserService = parserService; _displayService = displayService; }
public ExrinContainer(IApplicationInsights applicationInsights, IDisplayService displayService, IErrorHandlingService errorHandlingService, INavigationService navigationService) { ApplicationInsights = applicationInsights; DisplayService = displayService; ErrorHandlingService = errorHandlingService; NavigationService = navigationService; }
public Form1(IDisplayService idisplayService) { InitializeComponent(); //esta en el otro archivo de la clase //llamada a metodo propio this.set_elements(); this.StyleManager = this.metroStyleManager1; pictureB_loadingSearching.Visible = false; this.idisplayService = idisplayService; //this.StyleManager = msmMain; }
public PreviewRenderer(IDataProvider dataProvider, IDisplayService displayService, IWindowService windowService) { _dataProvider = dataProvider; _displayService = displayService; _windowService = windowService; CreatePreviews(); _displayService.DisplaysChanged += DisplayService_DisplaysChanged; }
private static void RegisterServices() { var kernel = new StandardKernel(); kernel.Load(new AtmSimulatorModule()); _bankBalanceRepository = kernel.Get <IBankBalanceRepository>(); _transactionService = kernel.Get <ITransactionService>(); _displayService = kernel.Get <IDisplayService>(); }
public ConfigurationHandler( ICredentialsRepository credentialsRepository, IDisplayService displayService) { Guard.NotNull(credentialsRepository, nameof(credentialsRepository)); Guard.NotNull(displayService, nameof(displayService)); _credentialsRepository = credentialsRepository; _displayService = displayService; }
public JobProcessor(IWindowService windowService, IDisplayService displayService, ICursorService cursorService, IDataProvider dataProvider, IPreviewRenderer previewRenderer, IActionExecutorFactory actionExecutorFactory) { _windowService = windowService ?? throw new ArgumentNullException(nameof(windowService)); _displayService = displayService ?? throw new ArgumentNullException(nameof(displayService)); _cursorService = cursorService ?? throw new ArgumentNullException(nameof(cursorService)); _dataProvider = dataProvider ?? throw new ArgumentNullException(nameof(dataProvider)); _previewRenderer = previewRenderer ?? throw new ArgumentNullException(nameof(previewRenderer)); _actionExecutorFactory = actionExecutorFactory ?? throw new ArgumentNullException(nameof(actionExecutorFactory)); }
public ScheduleListEditWindowViewModel( IPaginationSearchableRepository <ScheduleSubject> searchableRepository, IModelMapper <ScheduleSubject, ScheduleSubjectModel> subscriptionMapper, IEntityValidator <ScheduleSubjectModel> entityValidator, IDisplayService displayService) : base(searchableRepository, subscriptionMapper, entityValidator, displayService) { _displayService = displayService ?? throw new ArgumentNullException(nameof(displayService)); SelectGroupCommand = new RelayCommand(SelectGroupAction); }
public GroupsListEditWindowViewModel( IPaginationSearchableRepository <Group> searchableRepository, IEntityValidator <GroupModel> entityValidator, IModelMapper <Group, GroupModel> subscriptionMapper, IDisplayService displayService) : base(searchableRepository, subscriptionMapper, entityValidator, displayService) { _displayService = displayService ?? throw new ArgumentNullException(nameof(displayService)); SelectTrainerCommand = new RelayCommand(SelectTrainerAction); }
public HIPApi(ILoggingService logging = null, ISystemService system = null, ISwitchService switchService = null, IIOService io = null, IPhoneCallService phoneCall = null, ICameraService camera = null, IDisplayService display = null, IAudioService audio = null, IEmailService email = null) { _logging = logging; _system = system; _switch = switchService; _io = io; _phoneCall = phoneCall; _camera = camera; _display = display; _audio = audio; _email = email; }
public MovieService(IMoviesRepository moviesRepository, IDisplayService displayService, IImagesRepository imagesRepository) { var config = new MapperConfiguration(cfg => cfg.CreateMap <Movie, MovieDTO>() .ForMember(dest => dest.Image, opt => opt.MapFrom(src => src.Image.Image)) ); _moviesRepository = moviesRepository; _displayService = displayService; _imagesRepository = imagesRepository; _mapper = new Mapper(config); }
public Model(IDisplayService displayService, IApplicationInsights applicationInsights, IErrorHandlingService errorHandlingService, IModelState modelState) { _displayService = displayService; _errorHandlingService = errorHandlingService; _applicationInsights = applicationInsights; ModelState = modelState; Execution = new ModelExecution() { HandleTimeout = TimeoutHandle, HandleUnhandledException = HandleError }; }
public GameTests() { MockDisplayService = Substitute.For <IDisplayService>(); _testPlayerOne = new Player() { Id = 1, Name = "PlayerOne", PlayersSign = "x" }; _testPlayerTwo = new Player() { Id = 2, Name = "PlayerTwo", PlayersSign = "o" }; SUT = new Game(MockDisplayService); }
public void Test1() { // Need to Mock IViewService viewService = null; INavigationState state = null; IInjectionProxy injection = null; IDisplayService displayService = null; var navigationService = new NavigationService(viewService, state, injection, displayService); // Need to create and possibly Mock? IStack stack = null; navigationService.RegisterStack(stack); navigationService.Init((p) => { }, () => { return(new object()); }); }
public ServerListHandler( ISecurityService securityService, ITesonetClient tesonetClient, IServersRepository serversRepository, IDisplayService displayService) { Guard.NotNull(securityService, nameof(securityService)); Guard.NotNull(tesonetClient, nameof(tesonetClient)); Guard.NotNull(serversRepository, nameof(serversRepository)); Guard.NotNull(displayService, nameof(displayService)); _securityService = securityService; _tesonetClient = tesonetClient; _serversRepository = serversRepository; _displayService = displayService; }
public SelectEntityDialogViewModel( IPaginationSearchableRepository <TEntity> searchableRepository, IDialogsDisplayRegistry dialogsDisplayRegistry, IModelMapper <TEntity, TModel> entityMapper, IDisplayService displayService) { _dialogsDisplayRegistry = dialogsDisplayRegistry ?? throw new ArgumentNullException(nameof(dialogsDisplayRegistry)); _searchableRepository = searchableRepository ?? throw new ArgumentNullException(nameof(searchableRepository)); _displayService = displayService ?? throw new ArgumentNullException(nameof(displayService)); _entityMapper = entityMapper ?? throw new ArgumentNullException(nameof(entityMapper)); ItemsListViewModel = new ItemsListViewModel <TModel>(); ApplyCommand = new RelayCommand(_ => CloseAction(ItemsListViewModel.SelectedItem)); CancelCommand = new RelayCommand(_ => CloseAction(default(TModel))); }
public Model(IExrinContainer exrinContainer, IModelState modelState) { if (exrinContainer == null) throw new ArgumentNullException(nameof(IExrinContainer)); _displayService = exrinContainer.DisplayService; _errorHandlingService = exrinContainer.ErrorHandlingService; _applicationInsights = exrinContainer.ApplicationInsights; ModelState = modelState; Execution = new ModelExecution() { HandleTimeout = TimeoutHandle, HandleUnhandledException = HandleError }; }
public CardEditorWindowViewModel( IModelMapper <Student, StudentModel> studentMapper, ICardStudentAuthoriser cardStudentAuthoriser, IDisplayService displayService) { _studentMapper = studentMapper ?? throw new ArgumentNullException(nameof(studentMapper)); _cardStudentAuthoriser = cardStudentAuthoriser ?? throw new ArgumentNullException(nameof(cardStudentAuthoriser)); _displayService = displayService ?? throw new ArgumentNullException(nameof(displayService)); CardClearWriteCommand = new RelayCommand(_ => { bool result = _cardStudentAuthoriser.UnbindCard(); if (result) { CardInfoMessage = "<Данные с карты удалены>"; } else { MessageBox.Show("Неудача стирания значения", "Результат операции"); } }); CardWriteCommand = new RelayCommand(_ => { if (SelectedStudentId == null) { MessageBox.Show("Сначала необходимо выбрать ученика", "Ошибка"); } else { bool result = _cardStudentAuthoriser.BindCard((int)SelectedStudentId); if (result) { CardInfoMessage = SelectedStudentCaption; SelectedStudentId = null; SelectedStudentCaption = string.Empty; } else { MessageBox.Show("Неудача записи, попробуйте ещё раз", "Ошибка"); } } }); CloseCommand = new RelayCommand(_ => _displayService.Close(this)); SelectStudentCommand = new RelayCommand(SelectStudentAction); }
public static void ShowPopup(this IDisplayService displayService, string popupKey, Dictionary <string, Action <string> > callbacks) { PopupManager popupManager = displayService.Container.Resolve <IBrowserMessageManager>(popupKey) as PopupManager; if (popupManager != null) { if (callbacks != null) { foreach (string callbackKey in callbacks.Keys) { popupManager.AddCallback(popupKey, callbackKey, callbacks[callbackKey]); } } popupManager.ShowPopup(popupKey); } }
public MainWindowViewModel(IDisplayService displayService, ScheduleViewModel scheduleViewModel) { _displayService = displayService ?? throw new ArgumentNullException(nameof(displayService)); ScheduleViewModel = scheduleViewModel ?? throw new ArgumentNullException(nameof(scheduleViewModel)); GroupsEditCommand = new RelayCommand(_ => _displayService.ShowDialog <ItemsListEditWindowViewModel <Group, GroupModel> >()); StudentsEditCommand = new RelayCommand(_ => _displayService.ShowDialog <ItemsListEditWindowViewModel <Student, StudentModel> >()); TrainersEditCommand = new RelayCommand(_ => _displayService.ShowDialog <ItemsListEditWindowViewModel <Trainer, TrainerModel> >()); ScheduleEditCommand = new RelayCommand(_ => _displayService.ShowDialog <ItemsListEditWindowViewModel <ScheduleSubject, ScheduleSubjectModel> >()); OpenSubscriptionsCommand = new RelayCommand(_ => _displayService.ShowDialog <SubscriptionsWindowViewModel>()); OpenCardEditCommand = new RelayCommand(_ => _displayService.ShowDialog <CardEditorWindowViewModel>()); OpenReportsCommand = new RelayCommand(_ => _displayService.ShowDialog <ReportWindowViewModel>()); OpenAboutCommand = new RelayCommand(_ => _displayService.ShowDialog <AboutWindowViewModel>()); CloseCommand = new RelayCommand(_ => _displayService.Close(this)); }
public ViewModel(IExrinContainer exrinContainer, IVisualState visualState, [CallerFilePath] string caller = "ViewModel") { if (exrinContainer == null) { throw new ArgumentNullException(nameof(IExrinContainer)); } ApplicationInsights = exrinContainer.ApplicationInsights; DisplayService = exrinContainer.DisplayService; NavigationService = exrinContainer.NavigationService; ErrorHandlingService = exrinContainer.ErrorHandlingService; _containerSet = true; VisualState = visualState; SetExecution(); }
public ErrorHandlingService(IDisplayService displayService) { _displayService = displayService; }
public BandViewerViewModel(IDisplayService displayService) { DisplayService = displayService; }
/// <override></override> public override void CopyFrom(Shape source) { if (source == null) throw new ArgumentNullException("source"); this.permissionSetName = source.SecurityDomainName; this.tag = source.Tag; this.displayService = source.DisplayService; //this.Parent = source.Parent; //this.location.X = source.X; //this.location.Y = source.Y; // Do not recalculate Center after adding the children because in case the group is rotated, // the rotation center would not be the same. if (source.Children != null) children.CopyFrom(source.Children); // Do not assign to the property but to the field because the children are already on their (rotated) positions if (source is IPlanarShape) this.angle = ((IPlanarShape)source).Angle; if (source is ShapeGroup) this.angle = ((ShapeGroup)source).Angle; }
public AddArtistsViewModel(IUnityContainer container, IDisplayService displayService) : base(container) { DisplayService = displayService; }
private void AddPreview(Shape shape, Shape previewShape, IDisplayService displayService) { if (originalShapes.ContainsKey(previewShape)) return; if (previewShapes.ContainsKey(shape)) return; // Set DisplayService for the preview shape if (previewShape.DisplayService != displayService) previewShape.DisplayService = displayService; // Add shape and its preview to the appropriate dictionaries previewShapes.Add(shape, previewShape); originalShapes.Add(previewShape, shape); // Add shape's children and their previews to the appropriate dictionaries if (previewShape.Children.Count > 0) { IEnumerator<Shape> previewChildren = previewShape.Children.TopDown.GetEnumerator(); IEnumerator<Shape> originalChildren = shape.Children.TopDown.GetEnumerator(); previewChildren.Reset(); originalChildren.Reset(); bool processNext = false; if (previewChildren.MoveNext() && originalChildren.MoveNext()) processNext = true; while (processNext) { AddPreview(originalChildren.Current, previewChildren.Current, displayService); processNext = (previewChildren.MoveNext() && originalChildren.MoveNext()); } } }