private void AddPatient() { iRadiate.DataModel.HealthCare.Patient p = new DataModel.HealthCare.Patient(); DataStoreItemViewModel vm = new DataStoreItemViewModel(p); DesktopApplication.MakeModalDocument(vm, DesktopApplication.DocumentMode.New); }
private void PrintLabel() { DataStoreItemViewModel vm = new DataStoreItemViewModel((DataStoreItem)SelectedInventoryItem); if (SelectedInventoryItem is Generator) { DesktopApplication.MakeModalDocument(vm, "iRadiate.Radiopharmacy", "iRadiate.Radiopharmacy.View.GeneratorPrintView"); } else if (SelectedInventoryItem is SplitUnitDose) { vm = new SplitUnitDoseViewModel((DataStoreItem)SelectedInventoryItem); DesktopApplication.MakeModalDocument(vm, "iRadiate.Desktop.Common", "iRadiate.Desktop.Common.View.SplitUnitDosePrintView"); } else if (SelectedInventoryItem is BaseUnitDose) { vm = new BaseUnitDoseViewModel((DataStoreItem)SelectedInventoryItem); DesktopApplication.MakeModalDocument(vm, "iRadiate.Desktop.Common", "iRadiate.Desktop.Common.View.UnitDosePrintView"); } else if (SelectedInventoryItem is BaseBulkDose) { DesktopApplication.MakeModalDocument(vm, "iRadiate.Radiopharmacy", "iRadiate.Radiopharmacy.View.BulkDosePrintView"); } else if (SelectedInventoryItem is Kit) { DesktopApplication.MakeModalDocument(vm, "iRadiate.Radiopharmacy", "iRadiate.Radiopharmacy.View.ColdKitPrintView"); } }
public async static void MakeModalDocument(DataStoreItemViewModel _itemViewModel, string AssemblyName, string ViewName) { ChildWindow w = new ChildWindow(); w.OverlayBrush = null; w.CloseByEscape = true; w.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255)); w.EnableDropShadow = true; w.OverlayBrush = new SolidColorBrush(Colors.Gray) { Opacity = 0.5 }; w.AllowMove = true; w.ShowTitleBar = true; w.ShowCloseButton = true; UserControl control = GetView(AssemblyName, ViewName); control.Margin = new Thickness(2.0); control.DataContext = _itemViewModel; w.Content = control; ActiveWindow = w; _itemViewModel.Closing += _itemViewModel_ViewModelClosing; string t = Regex.Replace(_itemViewModel.Item.ConcreteType.Name, "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 "); w.Title = t; MainWindow.ShowDialogsOverTitleBar = true; await MainWindow.ShowChildWindowAsync(w, ChildWindowManager.OverlayFillBehavior.FullWindow); }
private void AddUser() { User u = new User(); DataStoreItemViewModel uvm = new DataStoreItemViewModel(u); Users.Add(u); DesktopApplication.MakeModalDocument(uvm); }
private void AddNewRole() { StaffMemberRole r = new StaffMemberRole(); DataStoreItemViewModel d = new DataStoreItemViewModel((StaffMemberRole)r); StaffMemberRoles.Add(r); DesktopApplication.MakeModalDocument(d, DesktopApplication.DocumentMode.New); }
private void AddRoom() { Room r = new Room(); Rooms.Add(r); r.NucMedPractice = DesktopApplication.CurrentPratice; DataStoreItemViewModel rvm = new DataStoreItemViewModel(r); DesktopApplication.MakeModalDocument(rvm, DesktopApplication.DocumentMode.New); }
private void AddNewStudyType() { StudyType st = new StudyType(); st.NucMedPractice = DesktopApplication.CurrentPratice; StudyTypes.Add(st); DataStoreItemViewModel stvm = new DataStoreItemViewModel(st); DesktopApplication.MakeModalDocument(stvm, DesktopApplication.DocumentMode.New); }
private void ViewItem() { if (SelectedInventoryItem != null) { SelectedInventoryItem.ItemSaving += InventoryItem_ItemSaved; if (SelectedInventoryItem.ConcreteType == typeof(ReconstitutedColdKit)) { ReconstitutedColdKitViewModel vm = new ReconstitutedColdKitViewModel((DataStoreItem)SelectedInventoryItem); DesktopApplication.MakeModalDocument(vm); } else if (SelectedInventoryItem.ConcreteType == typeof(Elution)) { ElutionViewModel dvm = new ElutionViewModel((DataStoreItem)SelectedInventoryItem); DesktopApplication.MakeModalDocument(dvm); } else if (SelectedInventoryItem.ConcreteType == typeof(SplitUnitDose)) { SplitUnitDoseViewModel dvm = new SplitUnitDoseViewModel((DataStoreItem)SelectedInventoryItem); DesktopApplication.MakeModalDocument(dvm); } else if (SelectedInventoryItem.ConcreteType == typeof(SyringeUnitDose)) { SyringeUnitDoseViewModel dvm = new SyringeUnitDoseViewModel((DataStoreItem)SelectedInventoryItem); DesktopApplication.MakeModalDocument(dvm); } else if (SelectedInventoryItem.ConcreteType == typeof(Generator)) { GeneratorViewModel dvm = new GeneratorViewModel((DataStoreItem)SelectedInventoryItem); DesktopApplication.MakeModalDocument(dvm); } else if (SelectedInventoryItem.ConcreteType == typeof(Kit)) { DataStoreItemViewModel dvm = new DataStoreItemViewModel((DataStoreItem)SelectedInventoryItem); DesktopApplication.MakeModalDocument(dvm); } else if (SelectedInventoryItem.ConcreteType == typeof(ReconstitutedColdKit)) { DataStoreItemViewModel dvm = new DataStoreItemViewModel((DataStoreItem)SelectedInventoryItem); DesktopApplication.MakeModalDocument(dvm); } else if (SelectedInventoryItem.ConcreteType == typeof(CapsuleUnitDose)) { CapsuleUnitDoseViewModel dvm = new CapsuleUnitDoseViewModel((DataStoreItem)SelectedInventoryItem); DesktopApplication.MakeModalDocument(dvm); } } else { DesktopApplication.ShowDialog("Debug", "SelectedInventoryItem is null"); } }
public override void AddNew() { Hospital newHospital = new Hospital(); newHospital.Name = "Enter name"; DataStoreItemViewModel stvm = new DataStoreItemViewModel(newHospital); Hospitals.Add(newHospital); DesktopApplication.MakeModalDocument(stvm); }
private void AddNewReservation() { RoomReservation r = new RoomReservation(); r.Description = "Describe what this reservation is for"; r.ReservationStart = DateTime.Now; r.ReservationFinish = DateTime.Now.AddHours(1); //DataStoreItemViewModel rvm = Application.GetLibrarian().GetViewModel(r); DataStoreItemViewModel rvm = new DataStoreItemViewModel(r); Reservations.Add(rvm); }
private bool CustomerFilter(object item) { DataStoreItemViewModel customer = item as DataStoreItemViewModel; if (customer == null) { return(true); } if (customer.Deleted) { return(false); } else { return(true); } }
/// <summary> /// Gets a view for a given DataStoreItemViewmodel /// </summary> /// <param name="viewModel">The DataStoreItemViewModel that will be tied to the view</param> /// <returns>If there DataStoreItemViewModel has a preferred view attribute it will instantiate and /// return that. If not the method will try to instantiate and return a view based on the /// underlying DataStoreItem</returns> private static UserControl GetView(DataStoreItemViewModel viewModel) { System.Attribute[] attrs = System.Attribute.GetCustomAttributes(viewModel.GetType()); foreach (System.Attribute attr in attrs) { if (attr is PreferredViewAttribute) { PreferredViewAttribute a = (PreferredViewAttribute)attr; ObjectHandle handle = Activator.CreateInstance(a.AssemblyName, a.ViewName); object p = handle.Unwrap(); return((UserControl)p); } } ObjectHandle handler = Activator.CreateInstance("iRadiate.Desktop.Common", "iRadiate.Desktop.Common.View." + viewModel.Item.ConcreteType.Name + "View"); object pr = handler.Unwrap(); return((UserControl)pr); }
/// <summary> /// Opens a DataStoreItemViewModel in a new document /// </summary> /// <param name="_itemViewModel">The DataStoreItemViewModel to be opened.</param> public static void MakeDocument(DataStoreItemViewModel _itemViewModel) { UserControl control = GetView(_itemViewModel); control.DataContext = _itemViewModel; LayoutDocument lc = new LayoutDocument(); lc.Title = _itemViewModel.DocumentTitle; lc.CanClose = true; lc.CanFloat = true; lc.Description = _itemViewModel.DocumentTitle; lc.ToolTip = _itemViewModel.DocumentTitle; Image img = new Image(); BitmapImage image = new BitmapImage(new Uri(_itemViewModel.DocumentIcon, UriKind.Relative)); lc.IconSource = image; lc.Content = control; MainWindow.MyLayoutDocumentPaneGroup.Children.Add(lc); lc.IsActive = true; }
private void viewChemical() { DataStoreItemViewModel dvm = new DataStoreItemViewModel((DataStoreItem)SelectedChemical); DesktopApplication.MakeModalDocument(dvm); }
public async static void MakeModalDocument(DataStoreItemViewModel _itemViewModel) { MakeModalDocument(_itemViewModel, DocumentMode.View); }