private Task ExportImage(ActionButtonViewModel source) { // Create dialog for user to pick save location SaveFileDialog dialog = new SaveFileDialog { FileName = $"{Clip.Model.Id}-{DateTime.UtcNow.ToFileTimeUtc()}", Filter = "Portable Network Graphics (*.png)|*.png|All files (*.*)|*.*" }; // Make sure that the dialog was accepted if (dialog.ShowDialog() != true) { return(Task.CompletedTask); } // Convert base64 string to an image IValueConverter converter = new Base64ToImageConverter(); if (!(converter.Convert(Clip.Model.Content, typeof(string), null, CultureInfo.CurrentCulture) is BitmapImage bitmapImage)) { return(Task.CompletedTask); } // Encode image as bitmap frame BitmapEncoder encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(bitmapImage)); // Save the frame to file using (FileStream fileStream = new FileStream(dialog.FileName, FileMode.Create)) { encoder.Save(fileStream); } return(Task.CompletedTask); }
public TechnicianTileListViewModel() { PopulateTechnicians(); AddTechnicianButton = new ActionButtonViewModel("Adaugă Tehnician", new DelegateCommand(OnAddTechnician), ImagePath.AddPatientPath); AddTechnicianTileViewModel = new AddTechnicianTileViewModel(this); SaveTechnicianButton = new ActionButtonViewModel("Salvează ", new DelegateCommand(OnSave), ImagePath.SaveIconPath); }
public FinancialScreenViewModel() { eventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>(); unityContainer = ServiceLocator.Current.GetInstance <IUnityContainer>(); eventAggregator.GetEvent <UpdateFinancialEvent>().Subscribe(UpdateFinancialScreen); GenerateButton = new ActionButtonViewModel("Generare Tabel", new DelegateCommand(OnGenerate), ImagePath.SaveIconPath); GenerateWordDocButton = new ActionButtonViewModel("Genereaza Word", new DelegateCommand(OnGenerateWordDoc), ImagePath.GenerateWord); }
public SettingsTileListViewModel(LocalCache.SettingsItemEnum settingType) { SettingType = settingType; PopulateSettingsItems(settingType); Name = settingType.ToString(); EditSettingsTileViewModel = new EditSettingsTileViewModel(this, settingsType); AddSettingButton = new ActionButtonViewModel("Adaugă " + Name, new DelegateCommand(OnAddSetting), ImagePath.AddPatientPath); SaveButton = new ActionButtonViewModel("Salvează ", new DelegateCommand(OnSave), ImagePath.SaveIconPath); deletedSettingsIds = new List <int>(); }
public AddInterventionTileViewModel(DentalRecordsScreeViewModel parent) { Parent = parent; eventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>(); SaveIntevertionButton = new ActionButtonViewModel("Salvează ", new DelegateCommand(Save), ImagePath.SaveIconPath); CancelIntevertionButton = new ActionButtonViewModel("Anulează ", new DelegateCommand(OnCancel), ImagePath.CancelIconPath); InitList(); IsPatientComboFocused = true; InitPercentage(); }
public FilterGroupViewModel(FIltersScreenViewModel parent) { Parent = parent; FiltersViewModels = new ObjectList <FiltersViewModel>(true); SaveGroupButton = new ActionButtonViewModel("Salvează Grup", new DelegateCommand(OnSaveGroup), ImagePath.AddPatientPath); AddGroupButton = new ActionButtonViewModel("Adaugă Grup ", new DelegateCommand(OnAddNewGroup), ImagePath.AddFilter); CancelGroupButton = new ActionButtonViewModel("Anulează ", new DelegateCommand(OnCancelAdd), ImagePath.CancelIconPath); SaveBtn = new ActionButtonViewModel("Afișează ", new DelegateCommand(OnSave), ImagePath.ShowFilters); eventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>(); InitLocalGroups(); PopulateFilterGroups(); }
public PersonalInfoScreenViewModel() { eventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>(); unityContainer = ServiceLocator.Current.GetInstance <IUnityContainer>(); eventAggregator.GetEvent <UpdatePersonalInfoEvent>().Subscribe(UpdatePersonalInfoScreen); eventAggregator.GetEvent <PatientSelectedEvent>().Subscribe(OnPatientSelected); eventAggregator.GetEvent <PatientDoubleClickedEvent>().Subscribe(OnPatientSelected); SaveBtn = new ActionButtonViewModel("Salvează ", new DelegateCommand(OnSave), ImagePath.SaveIconPath); EditButton = new ActionButtonViewModel("Editează ", new DelegateCommand(OnEdit), ImagePath.PatientEditPath); CancelButton = new ActionButtonViewModel("Renunță ", new DelegateCommand(OnCancel), ImagePath.CancelIconPath); DeletePatientButton = new ActionButtonViewModel("Șterge Pacient", new DelegateCommand(OnDelete), ImagePath.CancelIconPath); }
public MainViewModel(LocalSettings settings, IWindowManager windowManager, IEventAggregator eventAggregator) { this._settings = settings; this._windowManager = windowManager; this._eventAggregator = eventAggregator; this._eventAggregator.Subscribe(this); this.DeviceContainer = new DeviceContainerViewModel(windowManager, eventAggregator, _settings); this.NotesContainer = new NotesContainerViewModel(eventAggregator, _settings); this.ActionButton = new ActionButtonViewModel(eventAggregator); this._serializer = new RMSerialization(); Init(); }
public ClientShellViewModel(IEventAggregator eventAggregator, IUnityContainer unityContainer, IRegionManager regionManager) { this.eventAggregator = eventAggregator; ListViewModel = new LeftListViewModel(this); HorizontalTabsViewModel = new HorizontalTabsViewModel(); RegionHandlers = new RegionHandlers(eventAggregator, unityContainer, regionManager); RegionHandlers.Parent = this; eventAggregator.GetEvent <UserLoginEvent>().Subscribe(ConnectToServerAndLogin); ChangeCredentialsButton = new ActionButtonViewModel("", new DelegateCommand(OnChangeCredentials), DSA.Common.Infrastructure.ImagePath.DentistProfile); this.eventAggregator.GetEvent <TotalsModifiedEvent>().Subscribe(OnChangeTotalInfo); InterventionsGeneralDetailsViewModel = new InterventionsGeneralDetailsViewModel(); DownLoadDatabaseFromFtp(); }
public ImageContentScreenViewModel( IContentPresenter creator, ClipViewModel owner, Action <ContentScreen> releaseFn, ActionButtonViewModel actionButton) : base(creator, owner, releaseFn) { // Create export image button exportImageButton = actionButton; exportImageButton.ToolTip = "Save as file"; exportImageButton.Icon = (Geometry)Application.Current.FindResource("IconExport"); exportImageButton.ClickAction = ExportImage; exportImageButton.ConductWith(this); // Add export button to side controls of the clip Clip.SideControls.Add(exportImageButton); }
public LeftListViewModel(ClientShellViewModel parent) { AddPatientButton = new ActionButtonViewModel("+", new DelegateCommand(OnPatientAdd), ""); eventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>(); eventAggregator.GetEvent <PatientNameChangedEvent>().Subscribe(OnPatientNameChanged); eventAggregator.GetEvent <PatientAddedEvent>().Subscribe(OnPatientAdded); eventAggregator.GetEvent <PatientDeletedEvent>().Subscribe(OnPatientDeleted); Parent = parent; ImagePath = DSA.Common.Infrastructure.ImagePath.SigleIconPath; SearchImagePath = DSA.Common.Infrastructure.ImagePath.PatientSeadch; OnMergePatientsButton = new ActionButtonViewModel("Îmbinare pacienți", new DelegateCommand(OnPatientsMerge), DSA.Common.Infrastructure.ImagePath.PatientEditPath); MergePatientsButton = new ActionButtonViewModel("Imbină ", new DelegateCommand(MergePatients), DSA.Common.Infrastructure.ImagePath.PatientEditPath); CancelMergePatientsButton = new ActionButtonViewModel("Anulează ", new DelegateCommand(OnCancelMerge), DSA.Common.Infrastructure.ImagePath.CancelIconPath); }
public DialogOverlayPortalViewModel(IEventAggregator eventAggregator, Func <ActionButtonViewModel> actionButtonFactory) { this.eventAggregator = eventAggregator; Controls = new BindableCollection <ActionButtonViewModel>(); // Create control buttons ActionButtonViewModel button = actionButtonFactory.Invoke(); button.ToolTip = "Close"; button.Icon = (Geometry)Application.Current.FindResource("IconExit"); button.ClickAction = HandleCloseClick; button.ConductWith(this); Controls.Add(button); }
private Task HandleNavigationClick(ActionButtonViewModel control) { if (!(control is SelectableButtonViewModel selectableControl)) { return(Task.CompletedTask); } // De-select currently selected pages foreach (SelectableButtonViewModel pageControl in Pages) { pageControl.IsSelected = false; } // Select new one and notify about changes selectableControl.IsSelected = true; NotifyOfPropertyChange(() => Selected); NotifyOfPropertyChange(() => SelectedPageTitle); return(Task.CompletedTask); }
public NavigatorViewModel( IEnumerable <IScreenPage> availablePages, ILogger logger, Func <ActionButtonViewModel> actionButtonFactory, Func <SelectableButtonViewModel> selectableButtonFactory) { Logger = logger; List <IScreenPage> pages = availablePages.ToList(); // Print out available pages into log Logger.Info("Listing available pages for the navigator:"); foreach (IScreenPage page in pages) { Logger.Info($" - Title={page.Title}, Type={page.GetType().FullName}"); } // Order pages by it's defined order pages.Sort((x, y) => x.Order.CompareTo(y.Order)); // Create view models from available page definitions Pages = new BindableCollection <SelectableButtonViewModel>( pages.Select(page => { SelectableButtonViewModel button = selectableButtonFactory.Invoke(); button.ToolTip = page.Title; button.Icon = (Geometry)Application.Current.FindResource(page.Icon); button.Model = page; button.ClickAction = HandleNavigationClick; return(button); }) ); // Create controls Controls = new BindableCollection <ActionButtonViewModel>(); ActionButtonViewModel removeButton = actionButtonFactory.Invoke(); removeButton.Icon = (Geometry)Application.Current.FindResource("IconExit"); removeButton.ClickAction = Exit; Controls.Add(removeButton); }
public MaterialTileListViewModel(TechnicianTileViewModel parent) { Parent = parent; SaveButton = new ActionButtonViewModel("Salvează ", new DelegateCommand(OnSave), ImagePath.SaveIconPath); AddMaterialButton = new ActionButtonViewModel("Adaugă Material", new DelegateCommand(OnAddMaterial), ImagePath.AddPatientPath); }
public EditSettingsTileViewModel(SettingsTileListViewModel parent, LocalCache.SettingsItemEnum settingsItemEnum) { Parent = parent; SaveBtn = new ActionButtonViewModel("Salvează ", new DelegateCommand(OnSave), ImagePath.SaveIconPath); InitEditView(settingsItemEnum); }
public InterventionViewModel(ToothDetailsViewModel parent) { Parent = parent; SaveButton = new ActionButtonViewModel("Save", new DelegateCommand(OnSave), ImagePath.SaveIconPath); }
public WorkTileListViewModel() { PopulateWorks(); AddWorkButton = new ActionButtonViewModel("Adaugă Manoperă", new DelegateCommand(OnAddWork), ImagePath.AddPatientPath); SaveButton = new ActionButtonViewModel("Salvează ", new DelegateCommand(OnSave), ImagePath.SaveIconPath); }
public SettingsItemViewModel(LocalCache.SettingsItemEnum key) { AddSetItem = new ActionButtonViewModel("Add", new DelegateCommand(OnSettingAdded), ImagePath.SaveIconPath); PopulateSettingsSubItems(key); }
public AddTechnicianTileViewModel(TechnicianTileListViewModel parent) { Parent = parent; SaveTechnicianButton = new ActionButtonViewModel("Salvează ", new DelegateCommand(OnSave), ImagePath.SaveIconPath); }
public PatientViewModel(LeftListViewModel parent) { Parent = parent; SavePatientButton = new ActionButtonViewModel("Save", new DelegateCommand(OnSave)); }
private Task HandleCloseClick(ActionButtonViewModel button) { return(CloseDialog()); }
public SelectedItemTileViewModel(FilterItemViewModel parent) { Parent = parent; DeleteBtn = new ActionButtonViewModel("X", new DelegateCommand(OnDelete), ImagePath.CancelIconPath); }
public WorkTypeTileListViewModel(WorkTileViewModel parent) { AddWorkTypeButton = new ActionButtonViewModel("Adaugă Tip", new DelegateCommand(OnAddWorkType), ImagePath.AddPatientPath); Parent = parent; }