Beispiel #1
0
        private object ImageGetter(object rowObject)
        {
            if (CoreIconProvider == null)
            {
                return(null);
            }

            if (rowObject is AggregationTask)
            {
                return(GetImageForCompileable((Compileable)rowObject, CoreIconProvider.GetImage(((AggregationTask)rowObject).Aggregate)));
            }

            if (rowObject is AggregationContainerTask)
            {
                return(GetImageForCompileable((Compileable)rowObject, CoreIconProvider.GetImage(((AggregationContainerTask)rowObject).Container)));
            }

            var joinable = rowObject as JoinableTask;

            if (joinable != null)
            {
                return(CatalogueIcons.PatientIndexTable);
            }

            return(null);
        }
Beispiel #2
0
        public override bool SelectEnum(string prompt, Type enumType, out Enum chosen)
        {
            var selector = new PickOneOrCancelDialog <Enum>(Enum.GetValues(enumType).Cast <Enum>().ToArray(), prompt,
                                                            (o) => CoreIconProvider.GetImage(o),
                                                            null);

            if (selector.ShowDialog() == DialogResult.OK)
            {
                chosen = selector.Picked;
                return(true);
            }

            chosen = default;
            return(false);
        }
Beispiel #3
0
        public DockContent Activate(DeserializeInstruction instruction)
        {
            if (instruction.DatabaseObject != null && instruction.ObjectCollection != null)
            {
                throw new ArgumentException("DeserializeInstruction cannot have both a DatabaseObject and an ObjectCollection");
            }

            var c = _constructor.Construct(instruction.UIControlType);

            var uiInstance   = c as IRDMPSingleDatabaseObjectControl;
            var uiCollection = c as IObjectCollectionControl;

            //it has a database object so call SetDatabaseObject
            if (uiCollection != null)
            {
                //if we get here then Instruction wasn't for a
                return(Activate(uiCollection, instruction.ObjectCollection));
            }
            else
            if (uiInstance != null)
            {
                var databaseObject = instruction.DatabaseObject;

                //the database object is gone? deleted maybe
                if (databaseObject == null)
                {
                    return(null);
                }

                DockContent floatable = WindowFactory.Create(this, RefreshBus, uiInstance, CoreIconProvider.GetImage(databaseObject), databaseObject);

                floatable.Show(_mainDockPanel, DockState.Document);
                try
                {
                    uiInstance.SetDatabaseObject(this, (DatabaseEntity)databaseObject);
                    SetTabText(floatable, uiInstance);
                }
                catch (Exception e)
                {
                    floatable.Close();
                    throw new Exception("SetDatabaseObject failed on Control of Type '" + instruction.UIControlType.Name + "', control closed, see inner Exception for details", e);
                }

                return(floatable);
            }
            else
            {
                throw new PersistenceException("DeserializeInstruction must have either a DatabaseObject or an ObjectCollection");
            }
        }
Beispiel #4
0
 public T Activate <T, T2>(T2 databaseObject)
     where T : RDMPSingleDatabaseObjectControl <T2>, new()
     where T2 : DatabaseEntity
 {
     return(Activate <T, T2>(databaseObject, (Bitmap)CoreIconProvider.GetImage(databaseObject)));
 }
Beispiel #5
0
        private object ImageGetter(object rowObject)
        {
            bool hasProblems = _activator.HasProblem(rowObject);

            return(CoreIconProvider.GetImage(rowObject, hasProblems?OverlayKind.Problem:OverlayKind.None));
        }