Пример #1
0
        private void InitLaunchLaterUI()
        {
            InitSortingOptions();

            appsListVM = new AppsListViewModel();

            config = getConfiguration();

            var apps = (from a in config.DefaultProfile.Applications
                        select new AppViewModel {
                App = a
            }).ToList();

            ObservableCollection <AppViewModel> appViewModels = new ObservableCollection <AppViewModel>();

            apps.ForEach(x => appViewModels.Add(x));
            appsListVM.Applications = appViewModels;
            appsListVM.SortApps(AppSortingStyle.Name);

            AppsListBox.DataContext          = appsListVM;
            AppsListBox.OnChangeHasBeenMade += new AppsListView.ChangeHasBeenMadeHandler(AppsListBox_OnChangeHasBeenMade);
            AppsListBox.OnAppDeleted        += new AppsListView.DeleteAppHandler(AppsListBox_OnAppDeleted);

            checkForUpdatesAsynchronously();
        }
Пример #2
0
        // GET: Apps
        public ActionResult Index()
        {
            if (Request.Cookies["Visited"] == null)
            {
                var logdata = new
                {
                    Time      = DateTime.Now,
                    Browser   = Request.Browser,
                    IP        = Request.UserHostAddress,
                    UserAgent = Request.UserAgent
                };

                using (LogContext.PushProperty("Data", logdata, true))
                {
                    Log.Information("AppController page render");
                }

                Response.Cookies.Add(new HttpCookie("Visited", DateTime.Now.ToString("G")));
            }

            var model = new AppsListViewModel
            {
                ListDescription  = "Available applications",
                ApplicationsList = _applicationListHelper.GenerateList()
            };

            return(View(model));
        }
Пример #3
0
        void cmbSorting_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            AppSortingStyle style;

            switch (cmbSorting.SelectedItem.ToString())
            {
            case "Sort by Delay": style = AppSortingStyle.Timeline; break;

            case "Sort by Enabled": style = AppSortingStyle.Enabled; break;

            default: style = AppSortingStyle.Name; break;
            }

            AppsListViewModel vm = (AppsListViewModel)AppsListBox.DataContext;

            vm.SortApps(style);
            AppsListBox.DataContext = null;
            AppsListBox.DataContext = vm;
        }