Example #1
0
        public void ShowUserManager(Model.User user)
        {
            var userManagerWindow = new UserManageWindow(null, user);

            userManagerWindow.OnRemove = (userId) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageUser.DeleteUser(userId);
                });
            };
            userManagerWindow.OnSave = (editData) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageUser.SaveUser(editData.userData, editData.userId);
                });
            };
            userManagerWindow.OnBack = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(userManagerWindow);
                ShowUserList();
            };
            Top = Application.Top;
            Top.Add(userManagerWindow);
            Application.Run(Top);
        }
Example #2
0
        public override void Setup()
        {
            Win.Title  = this.GetName();
            Win.Y      = 1;           // menu
            Win.Height = Dim.Fill(1); // status bar
            Top.LayoutSubviews();

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_Quit", "", () => Quit()),
                }),
                new MenuBarItem("_Scenarios", new MenuItem [] {
                    new MenuItem("_Simple Nodes", "", () => LoadSimpleNodes()),
                    new MenuItem("_Rooms", "", () => LoadRooms()),
                    new MenuItem("_Armies With Builder", "", () => LoadArmies(false)),
                    new MenuItem("_Armies With Delegate", "", () => LoadArmies(true)),
                }),
            });

            Top.Add(menu);

            var statusBar = new StatusBar(new StatusItem [] {
                new StatusItem(Key.CtrlMask | Key.Q, "~^Q~ Quit", () => Quit()),
            });

            Top.Add(statusBar);

            // Start with the most basic use case
            LoadSimpleNodes();
        }
Example #3
0
 public void Inflate(T inflateSize)
 {
     Left   = Left.Subtract(inflateSize);
     Bottom = Bottom.Subtract(inflateSize);
     Right  = Right.Add(inflateSize);
     Top    = Top.Add(inflateSize);
 }
Example #4
0
        public void ShowRegistration()
        {
            var registrationWindow = new RegistrationWindow(null);

            registrationWindow.OnBack = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(registrationWindow);
                ShowLogin();
            };
            registrationWindow.OnExit = () =>
            {
                Application.Shutdown();
            };
            registrationWindow.OnRegister = (registerData) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.RegisterUser(registerData.name, registerData.password, registerData.email);
                });
            };
            Top = Application.Top;
            Top.Add(registrationWindow);
            Application.Run(Top);
        }
Example #5
0
        public override void Setup()
        {
            Win.Title  = this.GetName();
            Win.Y      = 1;           // menu
            Win.Height = Dim.Fill(1); // status bar
            Top.LayoutSubviews();

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_Quit", "", () => Quit()),
                })
            });

            Top.Add(menu);

            treeView = new TreeView()
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill(1),
            };
            treeView.KeyPress += TreeView_KeyPress;

            Win.Add(treeView);

            var statusBar = new StatusBar(new StatusItem [] {
                new StatusItem(Key.CtrlMask | Key.Q, "~^Q~ Quit", () => Quit()),
                new StatusItem(Key.CtrlMask | Key.C, "~^C~ Add Child", () => AddChildNode()),
                new StatusItem(Key.CtrlMask | Key.T, "~^T~ Add Root", () => AddRootNode()),
                new StatusItem(Key.CtrlMask | Key.R, "~^R~ Rename Node", () => RenameNode()),
            });

            Top.Add(statusBar);
        }
Example #6
0
        public void ShowUserList()
        {
            List <Model.User> users = MyController.manageUser.GetUserList();
            var userListWindow      = new UserListWindow(null, users);

            userListWindow.OnBack = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(userListWindow);
                ShowMenu();
            };
            userListWindow.OnRemove = (userId) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageUser.DeleteUser(userId);
                });
            };
            userListWindow.OnAdd = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(userListWindow);
                ShowUserManager(null);
            };
            userListWindow.OnEdit = (user) =>
            {
                Application.RequestStop();
                Application.Top.Remove(userListWindow);
                ShowUserManager(user);
            };
            Top = Application.Top;
            Top.Add(userListWindow);
            Application.Run(Top);
        }
Example #7
0
        public void ShowReservationManager(Model.Reservation reservation)
        {
            var users = MyController.manageUser.GetUserList();
            var reservationManagerWindow = new ReservationManageWindow(null, reservation, users, cars, MyController);

            reservationManagerWindow.OnRemove = (reservationId) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageReservation.DeleteReservation(reservationId);
                });
            };
            reservationManagerWindow.OnSave = (editData) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageReservation.SaveReservation(editData.reservationData, editData.reservationId);
                });
            };
            reservationManagerWindow.OnBack = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(reservationManagerWindow);
                ShowReservationList();
            };
            Top = Application.Top;
            Top.Add(reservationManagerWindow);
            Application.Run(Top);
        }
Example #8
0
        private void Ride(object obj)
        {
            CarTeam car          = obj as CarTeam;
            int     acceleration = car.MidleSpeed / car.TimeToMiddleSpeed;

            for (; ;)
            {
                if (car.Distance >= TotalDistance)
                {
                    car.Time.Stop();
                    Top.Add(car);
                    break;
                }

                Thread.Sleep(1000);

                if (car.CurrentSpeed >= car.MidleSpeed)
                {
                    car.CurrentSpeed = car.MidleSpeed;
                }
                else
                {
                    car.CurrentSpeed += acceleration;
                }

                car.Distance += acceleration;
            }

            Thread.CurrentThread.Abort();
        }
Example #9
0
        public void ShowCarManager(Model.Car car)
        {
            var carManagerWindow = new CarManageWindow(null, car, models);

            carManagerWindow.OnRemove = (carId) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageCars.DeleteCar(carId);
                });
            };
            carManagerWindow.OnSave = (editData) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageCars.SaveCar(editData.carData, editData.carId);
                    cars = MyController.manageCars.GetCarList();
                });
            };
            carManagerWindow.OnBack = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(carManagerWindow);
                ShowCarList();
            };
            Top = Application.Top;
            Top.Add(carManagerWindow);
            Application.Run(Top);
        }
Example #10
0
        public void ShowReservationList()
        {
            var users = MyController.manageUser.GetUserList();
            List <Model.Reservation> reserwations = MyController.manageReservation.GetReservationList();
            var reservationListWindow             = new ReservationListWindow(null, reserwations, users);

            reservationListWindow.OnBack = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(reservationListWindow);
                ShowMenu();
            };
            reservationListWindow.OnRemove = (reservationId) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageReservation.DeleteReservation(reservationId);
                });
            };
            reservationListWindow.OnAdd = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(reservationListWindow);
                ShowReservationManager(null);
            };
            reservationListWindow.OnEdit = (reservation) =>
            {
                Application.RequestStop();
                Application.Top.Remove(reservationListWindow);
                ShowReservationManager(reservation);
            };
            Top = Application.Top;
            Top.Add(reservationListWindow);
            Application.Run(Top);
        }
Example #11
0
        public void ShowUserSettings()
        {
            var userSettingsWindow = new UserSettingsWindow(null, user);

            userSettingsWindow.OnSettingsChange = (settingData) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageUser.ChangeUserSettings(settingData.name, settingData.surname, settingData.phone, settingData.adres1, settingData.adres2, settingData.adres3, settingData.userId);
                });
            };
            userSettingsWindow.OnPasswordChange = (passwordData) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageUser.ChangePassword(passwordData.oldPassword, passwordData.newPassword, passwordData.userId);
                });
            };
            userSettingsWindow.OnBack = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(userSettingsWindow);
                ShowMenu();
            };
            Top = Application.Top;
            Top.Add(userSettingsWindow);
            Application.Run(Top);
        }
Example #12
0
        public void ShowAppSettings()
        {
            Debug.WriteLine("Jestem w funkcji");
            var appSettingsWindow = new AppSettings(null);

            appSettingsWindow.OnSave = (mode) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    if (mode == 0)
                    {
                        Controller.AppController.AddOrUpdateAppSettings("interfaceType", "wpf");
                    }
                    else
                    {
                        Controller.AppController.AddOrUpdateAppSettings("interfaceType", "console");
                    }
                    ShowMessage("Ustawienia zapisane!");
                });
            };
            appSettingsWindow.OnBack = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(appSettingsWindow);
                ShowMenu();
            };
            Top = Application.Top;
            Top.Add(appSettingsWindow);
            Application.Run(Top);
        }
Example #13
0
        public void ShowLogin()
        {
            var loginWindow = new Login(null);

            loginWindow.OnLogin = (loginData) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.LoginUser(loginData.name, loginData.password, loginData.remember);
                });
            };
            loginWindow.OnRegister = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(loginWindow);
                ShowRegistration();
            };
            loginWindow.OnExit = () =>
            {
                Application.RequestStop();
            };

            Top = Application.Top;
            Top.Add(loginWindow);
            Application.Run(Top);
        }
Example #14
0
        public override void Setup()
        {
            Win.Title  = this.GetName();
            Win.Y      = 1;           // menu
            Win.Height = Dim.Fill(1); // status bar
            Top.LayoutSubviews();

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_New", "", () => New()),
                    new MenuItem("_Open", "", () => Open()),
                    new MenuItem("_Save", "", () => Save()),
                    new MenuItem("_Save As", "", () => SaveAs()),
                    new MenuItem("_Close", "", () => Close()),
                    new MenuItem("_Quit", "", () => Quit()),
                })
            });

            Top.Add(menu);

            tabView = new TabView()
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill(1),
            };

            tabView.Style.ShowBorder = false;
            tabView.ApplyStyleChanges();

            Win.Add(tabView);

            var statusBar = new StatusBar(new StatusItem [] {
                new StatusItem(Key.CtrlMask | Key.Q, "~^Q~ Quit", () => Quit()),

                // These shortcut keys don't seem to work correctly in linux
                //new StatusItem(Key.CtrlMask | Key.N, "~^O~ Open", () => Open()),
                //new StatusItem(Key.CtrlMask | Key.N, "~^N~ New", () => New()),

                new StatusItem(Key.CtrlMask | Key.S, "~^S~ Save", () => Save()),
                new StatusItem(Key.CtrlMask | Key.W, "~^W~ Close", () => Close()),
            });

            Win.Add(lblStatus = new Label("Len:")
            {
                Y             = Pos.Bottom(tabView),
                Width         = Dim.Fill(),
                TextAlignment = TextAlignment.Right
            });

            tabView.SelectedTabChanged += (s, e) => UpdateStatus(e.NewTab);

            Top.Add(statusBar);

            New();
        }
Example #15
0
        public override void Setup()
        {
            //Win.X = 1;
            //Win.Y = 2;
            //Win.Width = Dim.Fill () - 4;
            //Win.Height = Dim.Fill () - 2;
            var label = new Label("ScrollView (new Rect (5, 5, 100, 60)) with a 200, 100 ContentSize...")
            {
                X           = 0, Y = 0,
                ColorScheme = Colors.Dialog
            };

            Top.Add(label);

            var scrollView = new ScrollView(new Rect(3, 3, 50, 20));

            scrollView.ColorScheme = Colors.Menu;
            scrollView.ContentSize = new Size(100, 60);
            //ContentOffset = new Point (0, 0),
            scrollView.ShowVerticalScrollIndicator   = true;
            scrollView.ShowHorizontalScrollIndicator = true;

            var embedded1 = new Window("1")
            {
                X           = 3,
                Y           = 3,
                Width       = Dim.Fill(3),
                Height      = Dim.Fill(3),
                ColorScheme = Colors.Dialog
            };

            var embedded2 = new Window("2")
            {
                X           = 3,
                Y           = 3,
                Width       = Dim.Fill(3),
                Height      = Dim.Fill(3),
                ColorScheme = Colors.Error
            };

            embedded1.Add(embedded2);

            var embedded3 = new Window("3")
            {
                X           = 3,
                Y           = 3,
                Width       = Dim.Fill(3),
                Height      = Dim.Fill(3),
                ColorScheme = Colors.TopLevel
            };

            embedded2.Add(embedded3);

            scrollView.Add(embedded1);

            Top.Add(scrollView);
        }
Example #16
0
        public override void Setup()
        {
            Win.Title  = this.GetName();
            Win.Y      = 1;           // menu
            Win.Height = Dim.Fill(1); // status bar
            Top.LayoutSubviews();

            this.tableView = new TableViewColors()
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill(1),
            };

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_Quit", "", () => Quit()),
                }),
            });

            Top.Add(menu);

            var statusBar = new StatusBar(new StatusItem [] {
                new StatusItem(Key.CtrlMask | Key.Q, "~^Q~ Quit", () => Quit()),
            });

            Top.Add(statusBar);

            Win.Add(tableView);

            tableView.CellActivated += EditCurrentCell;

            var dt = new DataTable();

            dt.Columns.Add("Col1");
            dt.Columns.Add("Col2");

            dt.Rows.Add("some text", "Rainbows and Unicorns are so fun!");
            dt.Rows.Add("some text", "When it rains you get rainbows");
            dt.Rows.Add(DBNull.Value, DBNull.Value);
            dt.Rows.Add(DBNull.Value, DBNull.Value);
            dt.Rows.Add(DBNull.Value, DBNull.Value);
            dt.Rows.Add(DBNull.Value, DBNull.Value);

            tableView.ColorScheme = new ColorScheme()
            {
                Disabled = Win.ColorScheme.Disabled,
                HotFocus = Win.ColorScheme.HotFocus,
                Focus    = Win.ColorScheme.Focus,
                Normal   = Application.Driver.MakeAttribute(Color.DarkGray, Color.Black)
            };

            tableView.Table = dt;
        }
Example #17
0
        public override void Setup()
        {
            Win.Title  = this.GetName();
            Win.Y      = 1;           // menu
            Win.Height = Dim.Fill(1); // status bar
            Top.LayoutSubviews();

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_Quit", "", () => Quit()),
                })
                ,
                new MenuBarItem("_View", new MenuItem [] {
                    miShowPrivate = new MenuItem("_Include Private", "", () => ShowPrivate())
                    {
                        Checked   = false,
                        CheckType = MenuItemCheckStyle.Checked
                    },
                    new MenuItem("_Expand All", "", () => treeView.ExpandAll()),
                    new MenuItem("_Collapse All", "", () => treeView.CollapseAll())
                }),
            });

            Top.Add(menu);

            treeView = new TreeView <object> ()
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Percent(50),
                Height = Dim.Fill(),
            };


            treeView.AddObjects(AppDomain.CurrentDomain.GetAssemblies());
            treeView.AspectGetter      = GetRepresentation;
            treeView.TreeBuilder       = new DelegateTreeBuilder <object> (ChildGetter, CanExpand);
            treeView.SelectionChanged += TreeView_SelectionChanged;

            Win.Add(treeView);

            textView = new TextView()
            {
                X      = Pos.Right(treeView),
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            Win.Add(textView);
        }
Example #18
0
        public override void Setup()
        {
            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_New", "", () => New()),
                    new MenuItem("_Open", "", () => Open()),
                    new MenuItem("_Save", "", () => Save()),
                    null,
                    new MenuItem("_Quit", "", () => Quit()),
                }),
                new MenuBarItem("_Edit", new MenuItem [] {
                    new MenuItem("_Copy", "", () => Copy()),
                    new MenuItem("C_ut", "", () => Cut()),
                    new MenuItem("_Paste", "", () => Paste())
                }),
            });

            Top.Add(menu);

            var statusBar = new StatusBar(new StatusItem [] {
                new StatusItem(Key.F2, "~F2~ Open", () => Open()),
                new StatusItem(Key.F3, "~F3~ Save", () => Save()),
                new StatusItem(Key.ControlQ, "~^Q~ Quit", () => Quit()),
            });

            Top.Add(statusBar);

            CreateDemoFile(_fileName);

            Win = new Window(_fileName ?? "Untitled")
            {
                X      = 0,
                Y      = 1,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };
            Top.Add(Win);

            _textView = new TextView()
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill(),
            };

            LoadFile();

            Win.Add(_textView);
        }
Example #19
0
        public override void Setup()
        {
            Win.Title = this.GetName() + "-" + _fileName ?? "Untitled";

            CreateDemoFile(_fileName);
            //CreateUnicodeDemoFile (_fileName);

            _hexView = new HexView(LoadFile())
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill(),
            };
            _hexView.Edited          += _hexView_Edited;
            _hexView.PositionChanged += _hexView_PositionChanged;
            Win.Add(_hexView);

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_New", "", () => New()),
                    new MenuItem("_Open", "", () => Open()),
                    new MenuItem("_Save", "", () => Save()),
                    null,
                    new MenuItem("_Quit", "", () => Quit()),
                }),
                new MenuBarItem("_Edit", new MenuItem [] {
                    new MenuItem("_Copy", "", () => Copy()),
                    new MenuItem("C_ut", "", () => Cut()),
                    new MenuItem("_Paste", "", () => Paste())
                }),
                new MenuBarItem("_Options", new MenuItem [] {
                    miAllowEdits = new MenuItem("_AllowEdits", "", () => ToggleAllowEdits())
                    {
                        Checked = _hexView.AllowEdits, CheckType = MenuItemCheckStyle.Checked
                    }
                })
            });

            Top.Add(menu);

            statusBar = new StatusBar(new StatusItem [] {
                new StatusItem(Key.F2, "~F2~ Open", () => Open()),
                new StatusItem(Key.F3, "~F3~ Save", () => Save()),
                new StatusItem(Key.CtrlMask | Key.Q, "~^Q~ Quit", () => Quit()),
                siPositionChanged = new StatusItem(Key.Null,
                                                   $"Position: {_hexView.Position} Line: {_hexView.CursorPosition.Y} Col: {_hexView.CursorPosition.X} Line length: {_hexView.BytesPerLine}", () => {})
            });
            Top.Add(statusBar);
        }
Example #20
0
        public void ShowUserReservationList()
        {
            List <Model.Reservation> reserwations = MyController.manageReservation.GetUserReservation(user.UserId);
            var userReservationListWindow         = new UserReservationListWindow(null, reserwations);

            userReservationListWindow.OnBack = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(userReservationListWindow);
                ShowMenu();
            };
            Top = Application.Top;
            Top.Add(userReservationListWindow);
            Application.Run(Top);
        }
Example #21
0
        public void ShowStatusBarMessage(string text)
        {
            StatusButton = new Button(text)
            {
                X         = 0,
                Y         = Pos.Bottom(HostPane),
                IsDefault = true,
            };
            StatusButton.Clicked += () =>
            {
                Top.Remove(StatusButton);
            };

            Top.Add(StatusButton);
        }
Example #22
0
        public void ShowCarList()
        {
            CarListWindow carListWindow;

            if (user.Rola == Model.UserRole.User)
            {
                carListWindow = new CarListWindow(null, avaliableCars, user, MyController);
            }
            else
            {
                carListWindow = new CarListWindow(null, cars, user, MyController);
            }
            carListWindow.OnAdd = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(carListWindow);
                ShowCarManager(null);
            };
            carListWindow.OnEdit = (car) =>
            {
                Application.RequestStop();
                Application.Top.Remove(carListWindow);
                ShowCarManager(car);
            };
            carListWindow.OnRemove = (carId) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageCars.DeleteCar(carId);
                });
            };
            carListWindow.OnReservation = (car) =>
            {
                Application.RequestStop();
                Application.Top.Remove(carListWindow);
                ShowReservationWindow(car);
            };
            carListWindow.OnBack = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(carListWindow);
                ShowMenu();
            };
            Top = Application.Top;
            Top.Add(carListWindow);
            Application.Run(Top);
        }
Example #23
0
        public override void Setup()
        {
            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_Settings", new MenuItem [] {
                    null,
                    new MenuItem("_Quit", "", () => Quit()),
                }),
            });

            Top.Add(menu);

            var statusBar = new StatusBar(new StatusItem [] {
                new StatusItem(Key.CtrlMask | Key.Q, "~^Q~ Quit", () => Quit()),
            });

            Top.Add(statusBar);

            //Top.LayoutStyle = LayoutStyle.Computed;
            // Demonstrate using Dim to create a horizontal ruler that always measures the parent window's width
            // BUGBUG: Dim.Fill returns too big a value sometimes.
            const string rule            = "|123456789";
            var          horizontalRuler = new Label("")
            {
                X           = 0,
                Y           = 0,
                Width       = Dim.Fill(1),             // BUGBUG: I don't think this should be needed; DimFill() should respect container's frame. X does.
                ColorScheme = Colors.Error
            };

            Win.Add(horizontalRuler);

            // Demonstrate using Dim to create a vertical ruler that always measures the parent window's height
            // TODO: Either build a custom control for this or implement linewrap in Label #352
            const string vrule = "|\n1\n2\n3\n4\n5\n6\n7\n8\n9\n";

            var verticalRuler = new Label("")
            {
                X           = 0,
                Y           = 0,
                Width       = 1,
                Height      = Dim.Fill(),
                ColorScheme = Colors.Error
            };

            Win.LayoutComplete += (a) => {
                horizontalRuler.Text = rule.Repeat((int)Math.Ceiling((double)(horizontalRuler.Bounds.Width) / (double)rule.Length)) [0..(horizontalRuler.Bounds.Width)];
Example #24
0
        public override void Setup()
        {
            Win.Title  = this.GetName() + "-" + _fileName ?? "Untitled";
            Win.Y      = 1;           // menu
            Win.Height = Dim.Fill(1); // status bar
            Top.LayoutSubviews();

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_New", "", () => New()),
                    new MenuItem("_Open", "", () => Open()),
                    new MenuItem("_Save", "", () => Save()),
                    null,
                    new MenuItem("_Quit", "", () => Quit()),
                }),
                new MenuBarItem("_Edit", new MenuItem [] {
                    new MenuItem("_Copy", "", () => Copy()),
                    new MenuItem("C_ut", "", () => Cut()),
                    new MenuItem("_Paste", "", () => Paste())
                }),
            });

            Top.Add(menu);

            var statusBar = new StatusBar(new StatusItem [] {
                //new StatusItem(Key.Enter, "~ENTER~ ApplyEdits", () => { _hexView.ApplyEdits(); }),
                new StatusItem(Key.F2, "~F2~ Open", () => Open()),
                new StatusItem(Key.F3, "~F3~ Save", () => Save()),
                new StatusItem(Key.ControlQ, "~^Q~ Quit", () => Quit()),
            });

            Top.Add(statusBar);

            CreateDemoFile(_fileName);

            _hexView = new HexView(LoadFile())
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill(),
            };
            _hexView.CanFocus = true;
            Win.Add(_hexView);
        }
Example #25
0
        private void CreateLineData(double b, double m, double c)
        {
            double        p     = -25;
            List <double> a     = new List <double>();
            string        infos = "";

            for (int j = 0; j < 500; j++)
            {
                switch (suanfa)
                {
                case 0:
                    a.Add(b * Math.Pow(p, m) + c);
                    infos = "0|Y=" + b + "X**" + m + "+" + c;
                    break;

                case 1:
                    a.Add(b * Math.Sin(Math.Pow(p, m)) + c);
                    infos = "1|Y=" + b + "X**" + m + "+" + c;
                    break;

                case 2:
                    a.Add(b * Math.Cos(Math.Pow(p, m)) + c);
                    infos = "2|Y=" + b + "X**" + m + "+" + c;
                    break;

                case 3:
                    a.Add(b * Math.Tan(Math.Pow(p, m)) + c);
                    infos = "3|Y=" + b + "X**" + m + "+" + c;
                    break;
                }

                p += 0.1;
            }
            Top.Add(a.Max());
            LineInfo info = new LineInfo
            {
                Data = a,
                Info = infos
            };

            Lines.Add(info);
        }
Example #26
0
        public void ShowReservationWindow(Model.Car selectedCar = null)
        {
            var reservationWindow = new ReservationWindow(null, avaliableCars, selectedCar, user, MyController);

            reservationWindow.OnSave = (reservationData) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageReservation.AddReservation(reservationData);
                });
            };
            reservationWindow.OnBack = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(reservationWindow);
                ShowMenu();
            };
            Top = Application.Top;
            Top.Add(reservationWindow);
            Application.Run(Top);
        }
        public override void Setup()
        {
            Win.Title  = this.GetName();
            Win.Y      = 1;           // menu
            Win.Height = Dim.Fill(1); // status bar
            Top.LayoutSubviews();

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    miWrap = new MenuItem("_Word Wrap", "", () => WordWrap())
                    {
                        CheckType = MenuItemCheckStyle.Checked
                    },
                    new MenuItem("_Quit", "", () => Quit()),
                })
            });

            Top.Add(menu);

            textView = new SqlTextView()
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill(1),
            };

            textView.Init();

            textView.Text = "SELECT TOP 100 * \nfrom\n MyDb.dbo.Biochemistry;";

            Win.Add(textView);

            var statusBar = new StatusBar(new StatusItem [] {
                new StatusItem(Key.CtrlMask | Key.Q, "~^Q~ Quit", () => Quit()),
            });


            Top.Add(statusBar);
        }
Example #28
0
        public void ShowMarkManage()
        {
            var markManageWindow = new MarkManageWindow(Application.Top, marks);

            markManageWindow.OnRemove = (id) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageCars.DeleteMark(id);
                });
            };
            markManageWindow.OnAdd = (String markName) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageCars.AddMark(markName);
                    marks = MyController.manageCars.GetMarkList();
                    markManageWindow.MarkManager = marks;
                });
            };
            markManageWindow.OnEdit = (markData) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageCars.EditMark(markData.name, markData.id);
                    marks = MyController.manageCars.GetMarkList();
                    markManageWindow.MarkManager = marks;
                });
            };
            markManageWindow.OnBack = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(markManageWindow);
                ShowMenu();
            };

            Top = Application.Top;
            Top.Add(markManageWindow);
            Application.Run(Top);
        }
Example #29
0
        public override void Run()
        {
            Top?.Dispose();

            //Top = new Toplevel (new Rect (0, 0, Application.Driver.Cols, Application.Driver.Rows));

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_Файл", new MenuItem [] {
                    new MenuItem("_Создать", "Creates new file", null),
                    new MenuItem("_Открыть", "", null),
                    new MenuItem("Со_хранить", "", null),
                    new MenuItem("_Выход", "", () => { if (Quit())
                                                       {
                                                           Application.RequestStop();
                                                       }
                                 })
                }),
                new MenuBarItem("_Edit", new MenuItem [] {
                    new MenuItem("_Copy", "", null),
                    new MenuItem("C_ut", "", null),
                    new MenuItem("_Paste", "", null)
                })
            });

            Top.Add(menu);

            // BUGBUG: #437 This being commented out causes menu to mis-behave
            var win = new Window($"Scenario: {GetName ()}")
            {
                X      = 0,
                Y      = 1,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            Top.Add(win);

            base.Run();
        }
Example #30
0
        public void ShowModelManage()
        {
            ModelManageWindow modelManageWindow = new ModelManageWindow(Application.Top, models, marks);

            modelManageWindow.OnBack = () =>
            {
                Application.RequestStop();
                Application.Top.Remove(modelManageWindow);
                ShowMenu();
            };
            modelManageWindow.OnRemove = (id) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageCars.DeleteModel(id);
                });
            };
            modelManageWindow.OnAdd = (addData) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageCars.AddModel(addData.name, addData.markId);
                    models = MyController.manageCars.GetModelsList();
                    modelManageWindow.SetModel = models;
                });
            };
            modelManageWindow.OnEdit = (editData) =>
            {
                Application.MainLoop.Invoke(() =>
                {
                    MyController.manageCars.EditModel(editData.name, editData.modelId, editData.markId);
                    models = MyController.manageCars.GetModelsList();
                    modelManageWindow.SetModel = models;
                });
            };
            Top = Application.Top;
            Top.Add(modelManageWindow);
            Application.Run(Top);
        }