Beispiel #1
0
        private void refreshAvailableAppsListView()
        {
            if (manager == null || manager.AvailableApps == null)
            {
                return;
            }

            listViewAvailableApps.Items.Clear();

            if (manager.AvailableApps.Count == 0)
            {
                listViewAvailableApps.Columns.Clear();
                lblNoApps.Visible = true;
                return;
            }

            lblNoApps.Visible = false;
            if (listViewAvailableApps.Columns.Count == 0)
            {
                listViewAvailableApps.Columns.Add("Name", 200);
                listViewAvailableApps.Columns.Add("Size", 75, HorizontalAlignment.Right);
                listViewAvailableApps.View = View.Details;
            }

            ListViewItem           lvi;
            FileSizeFormatProvider fmt = new FileSizeFormatProvider();

            foreach (AppInfo app in manager.AvailableApps)
            {
                lvi     = new ListViewItem(new string[] { app.Name, String.Format(fmt, "{0:fs}", app.Size) });
                lvi.Tag = app;
                listViewAvailableApps.Items.Add(lvi);
            }

            refreshLibraryListView(); // todo - set up a separate event handler
        }
Beispiel #2
0
        private void refreshLibraryListView()
        {
            if (manager == null || manager.Library == null)
            {
                return;
            }

            listViewLibrary.Items.Clear();

            if (manager.Library.Apps.Count == 0)
            {
                labelNoLibraryApps.Visible = true;
                listViewLibrary.Columns.Clear();
                return;
            }

            labelNoLibraryApps.Visible = false;
            if (listViewLibrary.Columns.Count == 0)
            {
                listViewLibrary.Columns.Add("Name", 200);
                listViewLibrary.Columns.Add("Size", 75, HorizontalAlignment.Right);
                listViewLibrary.View = View.Details;
            }


            ListViewItem           lvi;
            FileSizeFormatProvider fmt = new FileSizeFormatProvider();

            foreach (AppInfo app in manager.Library.Apps.Values)
            {
                lvi     = new ListViewItem(new string[] { app.Name, String.Format(fmt, "{0:fs}", app.Size) });
                lvi.Tag = app;
                listViewLibrary.Items.Add(lvi);
            }
            listViewLibrary.Sort();
        }