protected void ScreenChange(SceneData screen, params object[] options) { f.Remove(current); current.Destroy(); current = screen.CreateInstance(options); f.Put(current, 0, 0); f.Remove(side); side.Destroy(); side = new MySideBar(); f.Put(side, 0, 20); side.Show(); if (currentScene == "Logger") { var logScreen = current as LoggerWindow; if (logScreen != null) { side.ExpandEvent += (sender, e) => { logScreen.tv.Visible = false; logScreen.tv.QueueDraw(); }; side.CollapseEvent += (sender, e) => { logScreen.tv.Visible = true; logScreen.tv.QueueDraw(); }; } } else if (currentScene == "Alarms") { var alarmScreen = current as AlarmWindow; if (alarmScreen != null) { side.ExpandEvent += (sender, e) => { alarmScreen.tv.Visible = false; alarmScreen.tv.QueueDraw(); }; side.CollapseEvent += (sender, e) => { alarmScreen.tv.Visible = true; alarmScreen.tv.QueueDraw(); }; } } f.Remove(notification); notification = new MyNotificationBar(); f.Put(notification, 0, 0); notification.Show(); QueueDraw(); }
protected AquaPicGui() : base(WindowType.Toplevel) { Name = "AquaPicGUI"; Title = "AquaPic Controller Version 0"; WindowPosition = WindowPosition.Center; SetSizeRequest(800, 480); Resizable = false; AllowGrow = false; DeleteEvent += (o, args) => { Application.Quit(); args.RetVal = true; }; ModifyBg(StateType.Normal, TouchColor.NewGtkColor("grey0")); #if RPI_BUILD this.Decorated = false; this.Fullscreen(); #endif GLib.ExceptionManager.UnhandledException += (args) => { Exception ex = args.ExceptionObject as Exception; Logger.AddError(ex.ToString()); args.ExitApplication = false; }; ChangeSceneEvent += ScreenChange; scenes = new Dictionary <string, SceneData> { { "Power", new SceneData("Power", true, (options) => { return(new PowerWindow(options)); }) }, { "Lighting", new SceneData("Lighting", true, (options) => { return(new LightingWindow(options)); }) }, { "Temperature", new SceneData("Temperature", true, (options) => { return(new TemperatureWindow(options)); }) }, { "Water Level", new SceneData("Water Level", true, (options) => { return(new WaterLevelWindow(options)); }) }, { "Sensors", new SceneData("Sensors", true, (options) => { return(new SensorsWindow(options)); }) }, { "Chemistry", new SceneData("Chemistry", true, (options) => { return(new ChemistryWindow(options)); }) }, { "Analog Output", new SceneData("Analog Output", true, (options) => { return(new AnalogOutputWindow(options)); }) }, { "Analog Input", new SceneData("Analog Input", true, (options) => { return(new AnalogInputWindow(options)); }) }, { "Digital Input", new SceneData("Digital Input", true, (options) => { return(new DigitalInputWindow(options)); }) }, { "pH/ORP", new SceneData("pH/ORP", true, (options) => { return(new PhOrpWindow(options)); }) }, { "Serial Bus", new SceneData("Serial Bus", true, (options) => { return(new SerialBusWindow(options)); }) }, { "Alarms", new SceneData("Alarms", true, (options) => { return(new AlarmWindow(options)); }) }, { "Logger", new SceneData("Logger", true, (options) => { return(new LoggerWindow(options)); }) }, { "Settings", new SceneData("Settings", true, (options) => { return(new SettingsWindow(options)); }) }, { "Menu", new SceneData("Menu", false, (options) => { return(new MenuWindow(options)); }) }, { "Home", new SceneData("Home", true, (options) => { return(new HomeWindow(options)); }) } }; currentScene = "Home"; f = new Fixed(); f.SetSizeRequest(800, 480); current = scenes[currentScene].CreateInstance(); f.Put(current, 0, 0); current.Show(); side = new MySideBar(scenes, currentScene); f.Put(side, 0, 20); side.Show(); notification = new MyNotificationBar(); f.Put(notification, 0, 0); notification.Show(); Add(f); f.Show(); Show(); }