Exemplo n.º 1
0
        private OfferChanceToSaveDialogUI(IRevertable revertable, RevertableObjectReport differences)
        {
            _revertable = revertable;
            InitializeComponent();

            if (revertable == null)
            {
                return;
            }

            Text = "Save changes to " + revertable.GetType().Name + " " + revertable + " (ID = " + revertable.ID + ")";

            lblFirstPrompt.Text = "Would you like to save changes to " + revertable.GetType().Name + " '" + revertable + "' (ID=" + revertable.ID + ")";

            tableLayoutPanel1.RowCount = differences.Differences.Count;
            for (int index = 0; index < differences.Differences.Count; index++)
            {
                var d     = differences.Differences[index];
                var toAdd = new RevertablePropertyDifferenceUI(d);
                toAdd.Dock = DockStyle.Fill;
                tableLayoutPanel1.Controls.Add(toAdd, 0, index);
            }

            for (int i = 0; i < tableLayoutPanel1.RowStyles.Count; i++)
            {
                tableLayoutPanel1.RowStyles[i].SizeType = SizeType.AutoSize;
            }
        }
Exemplo n.º 2
0
        public ConsoleGuiEdit(IBasicActivateItems activator, IRevertable databaseObject)
        {
            _activator     = activator;
            DatabaseObject = databaseObject;

            ColorScheme = ConsoleMainWindow.ColorScheme;
            collection  =

                TableRepository.GetPropertyInfos(DatabaseObject.GetType())
                .Select(p => new PropertyInListView(p, DatabaseObject)).ToList();

            list = new ListView(collection)
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(2),
                Height = Dim.Fill(2)
            };
            list.KeyPress += List_KeyPress;

            var btnSet = new Button("Set")
            {
                X         = 0,
                Y         = Pos.Bottom(list),
                IsDefault = true
            };

            btnSet.Clicked += () =>
            {
                SetProperty(false);
            };

            var btnClose = new Button("Close")
            {
                X = Pos.Right(btnSet),
                Y = Pos.Bottom(list)
            };

            btnClose.Clicked += () => Application.RequestStop();

            this.Add(list);
            this.Add(btnSet);
            this.Add(btnClose);
        }