Beispiel #1
0
 public AppModel()
 {
     Screens = Screen.AllScreens
               .Select((s, i) => new DisplayScreen(i + 1, s))
               .ToArray();
     SelectedScreen.Value = Screens.FirstOrDefault(s => !s.Screen.Primary) ?? Screens.First();
 }
 public IDockScreen this[string name]
 {
     get
     {
         var screen = Screens.FirstOrDefault(item => string.Equals(item.Name, name));
         if (screen == null)
         {
             throw new ArgumentException("The name of DockScreen is not found, please check the name");
         }
         return(screen);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Fills in any missing values and records it can to assist templating
        /// </summary>
        internal bool Resolve(out string message)
        {
            var errors = new List <string>();

            // Set Default Values for nullable fields
            if (!ImutableDatabase.HasValue)
            {
                ImutableDatabase = true;
            }
            if (!DefaultScreenId.HasValue)
            {
                DefaultScreenId = Screens.FirstOrDefault().Id;
            }

            // Still could be null if no screens have been setup yet
            if (DefaultScreenId.HasValue)
            {
                DefaultScreen = Screens.Single(a => a.Id == DefaultScreenId);
            }

            // Resolve child records
            foreach (var entity in Entities)
            {
                if (!entity.Resolve(this, out string entityMessage))
                {
                    errors.Add(entityMessage);
                }
            }
            foreach (var screen in Screens)
            {
                if (!screen.Resolve(this, out string screenMessage))
                {
                    errors.Add(screenMessage);
                }
            }

            GenerateAdminScreenAndMenu();

            if (errors.Any())
            {
                message = string.Join(Environment.NewLine, errors);
                return(false);
            }
            else
            {
                message = "Success";
                return(true);
            }
        }
Beispiel #4
0
        private void PlaceScreen()
        {
            if (Screens == null)
            {
                return;
            }

            SelectedScreen = Screens.FirstOrDefault(s => s.Index == Settings.Screen);

            if (SelectedScreen == null)
            {
                return;
            }

            switch (Settings.Placement)
            {
            case NotificationPlacement.TopLeft:
                SelectedScreen.NotificationPlacementTopLeft = true;
                break;

            case NotificationPlacement.BottomLeft:
                SelectedScreen.NotificationPlacementBottomLeft = true;
                break;

            case NotificationPlacement.TopRight:
                SelectedScreen.NotificationPlacementTopRight = true;
                break;

            case NotificationPlacement.BottomRight:
                SelectedScreen.NotificationPlacementBottomRight = true;
                break;

            default:
                SelectedScreen.NotificationPlacementBottomLeft = true;
                break;
            }

            Settings.Left = SelectedScreen.Left;
        }
Beispiel #5
0
 /// <summary>
 /// Gets the screen at location.
 /// </summary>
 /// <returns>The screen at location.</returns>
 /// <param name="x">The x coordinate.</param>
 /// <param name="y">The y coordinate.</param>
 public static Screen GetScreenAtLocation(double x, double y)
 {
     return(Screens.FirstOrDefault(s => s.Bounds.Contains(x, y)));
 }
Beispiel #6
0
 private SMASetupScreenBase FindNextScreen()
 {
     return(Screens.FirstOrDefault(s => s.IsSetup == false));
 }