示例#1
0
        public CarouselVM(IConfigDefaultOSUser configDefaultOSUser)
        {
            this._ConfigDefaultOSUser = configDefaultOSUser;
            this.CarouselUserVM       = new CarouselUserVM();

            IList <string> availableOSUsersList = new List <string>();

            UnityContainerHelper.Container.Resolve <IShortcutCarouselService>().Using(service => {
                foreach (string s in service.GetOSUserList())
                {
                    availableOSUsersList.Add(s);
                }
            });

            this.AvailableOSUsers = new ObservableCollection <OSUserVM>();
            foreach (string item in availableOSUsersList)
            {
                this.AvailableOSUsers.Add(new OSUserVM()
                {
                    OSUserName = item, IsCurrentOSUser = false
                });
            }

            if (this.AvailableOSUsers.Count == 0)
            {
                log.Error(@"CarouselVM() found no available osusers to load.");
            }
            else
            {
                bool found = false;
                foreach (OSUserVM osuserVM in this.AvailableOSUsers)
                {
                    if (!found && osuserVM.OSUserName == this._ConfigDefaultOSUser.DefaultOSUSer)
                    {
                        this.SwitchToOSUser(osuserVM.OSUserName);
                        found = true;
                    }
                }
                if (!found)
                {
                    log.Info(@"CarouselVM(): you have not correctly configured your default osuser and it has not been found.");
                    this.SwitchToOSUser(this.AvailableOSUsers[0].OSUserName);
                }
            }

            this.StayOnTop = false;
        }
 public MainWindowVM(IConfigDefaultOSUser configDefaultOSUser)
 {
     this._ConfigDefaultOSUser = configDefaultOSUser;
     this.CarouselVM           = new CarouselVM(this._ConfigDefaultOSUser);
 }