Пример #1
0
        private async Task RefreshApps()
        {
            var wm = Caliburn.Micro.IoC.Get <IWindowManager>();

            wm.ShowBusyView("Loading Apps...");
            try
            {
                AppInfoEnvelope envelope = await AppInfoEnvelope.Load(this._selectedUserConfiguration.UserConfiguration);

                List <AppConfigViewModel> list = new List <AppConfigViewModel>();
                if (envelope != null && envelope.Apps != null)
                {
                    foreach (AppInfo current in envelope.Apps)
                    {
                        list.Add(new AppConfigViewModel(current));
                    }
                }

                this.Apps = CollectionViewSource.GetDefaultView(list);
                this.Apps.SortDescriptions.Add(new SortDescription("Platform", ListSortDirection.Ascending));
                this.Apps.Filter = (x) => { return((x as AppConfigViewModel).Title.ToUpper().Contains(this.FilterString.ToUpper()) ||
                                                   (x as AppConfigViewModel).Platform.ToUpper().Contains(this.FilterString.ToUpper())); };
                NotifyOfPropertyChange(() => this.Apps);
            }
            catch (Exception ex)
            {
                wm.ShowMetroMessageBox(ex.Message);
                throw;
            }
            finally
            {
                wm.HideBusyView();
            }
        }
Пример #2
0
        public async Task <List <AppInfo> > GetMatchingApps(CommandLineArgs args)
        {
            Configuration configuration = Configuration.Instance;

            this._args = args;
            if (!String.IsNullOrWhiteSpace(args.Accountname))
            {
                ActiveUserConfiguration = configuration.UserConfigurations.FirstOrDefault(p => p.ConfigurationName.ToUpper().Equals(args.Accountname.ToUpper()));
            }
            else
            {
                ActiveUserConfiguration = configuration.DefaultUserConfiguration;
            }
            if (ActiveUserConfiguration == null)
            {
                throw new Exception("Wrong AccountName or no default account configured!");
            }

            this._envelope = await AppInfoEnvelope.Load(ActiveUserConfiguration);

            switch (args.Platform)
            {
            case AppInfoPlatforms.None:
                throw new Exception("Platform not supported!");

            case AppInfoPlatforms.Android:
                MatchAndroid();
                break;

            case AppInfoPlatforms.Windows:
                MatchWindows();
                break;

            case AppInfoPlatforms.Custom:
                MatchCustom();
                break;

            case AppInfoPlatforms.WindowsPhone:
                MatchWindowsPhone();
                break;
            }

            if (_matchingApps.Count == 0)
            {
                this._matchingApps.AddRange(this._envelope.Apps.Where(p => p.Platform == args.Platform));
            }

            return(_matchingApps);
        }