コード例 #1
0
ファイル: ImportPage.cs プロジェクト: sf43205/euteg8y58
        private void Reload()
        {
            if (fetching)
            {
                return;
            }

            fetching = true;

            if (Row.DefaultRow == null)
            {
                Row.DefaultRow = Table.Controls[0].Clone();
            }

            Project.GetAll((res) =>
            {
                Data = res;
                Table.Controls.Clear();
                Table.RowStyles.Clear();
                Table.RowCount = Data.Count();
                Data.ForEach(x =>
                {
                    var row        = new Row(x);
                    RowStyle style = new RowStyle()
                    {
                        SizeType = SizeType.Absolute,
                        Height   = 48
                    };
                    Table.Controls.Add(row.control);
                    row.Clicked += (s, e) => PhaseSelection.Open(s as Project);
                    SetMenu(x, row.control);
                    Table.RowStyles.Add(style);
                });
                Table.Controls.Add(new Panel());
                Table.Refresh();
                fetching = false;
            });

            void SetMenu(Project p, Control c)
            {
                var Menu = new ContextMenu();

                c.ContextMenu = Menu;
                MenuItem edit      = new MenuItem("Edit " + p.name);
                MenuItem locations = new MenuItem("See Locations");

                Menu.MenuItems.Add(edit);
                Menu.MenuItems.Add(locations);

                edit.Click += (s, e) => NewProject.Open(p, (saved) =>
                {
                    if (saved)
                    {
                        Reload();
                    }
                });

                locations.Click += (s, e) => LocationsPage.Show(p);
            }
        }
コード例 #2
0
        private void Reload()
        {
            if (fetching)
            {
                return;
            }

            fetching = true;

            if (Row.DefaultRow == null)
            {
                Row.DefaultRow = Table.Controls[0].Clone();
            }

            Project.GetAll((res) =>
            {
                Data = res;
                Table.Controls.Clear();
                Table.RowStyles.Clear();
                Table.RowCount = Data.Count();
                Data.ForEach(x =>
                {
                    var row        = new Row(x);
                    RowStyle style = new RowStyle()
                    {
                        SizeType = SizeType.Absolute,
                        Height   = 48
                    };
                    Table.Controls.Add(row.control);
                    row.Clicked      += (s, e) => PhaseSelection.Open(s as Project);
                    row.RightClicked += (s, e) => NewProject.Open(x, (saved) =>
                    {
                        if (saved)
                        {
                            Reload();
                        }
                    });
                    Table.RowStyles.Add(style);
                });
                Table.Controls.Add(new Panel());
                Table.Refresh();
                fetching = false;
            });
        }