//Currently does not work public void ShowDemoNotification() { if (tray != null) { tray.ShowNotification(5000, "Test Notification", "This is a Rainity-powered notification!"); } }
void ResetPos() { var cc = FindObjectOfType <CameraCtrl>(); if (cc) { cc.ResetPos(); _icon.ShowNotification(3, "嘤嘤嘤", "嘤嘤怪回到了初始位置"); } }
/// <summary> /// initialize traymenu, called after menucontroller script initilization. Running on Main Unity Thread x_x.. /// </summary> public void Start_() { tray = CreateSystemTrayIcon(); if (tray != null) { tray.SetTitle("rePaper"); MenuItem weather = new MenuItem("Weather"); weathers[0] = tray.trayMenu.MenuItems.Add("Clear", new EventHandler(Weather_Btn)); weathers[1] = tray.trayMenu.MenuItems.Add("Thunder & Heavy Rain", new EventHandler(Weather_Btn)); weathers[2] = tray.trayMenu.MenuItems.Add("Ragged Thunder", new EventHandler(Weather_Btn)); weathers[3] = tray.trayMenu.MenuItems.Add("Drizzle Thunder", new EventHandler(Weather_Btn)); weathers[4] = tray.trayMenu.MenuItems.Add("Thunderstorm", new EventHandler(Weather_Btn)); weathers[5] = tray.trayMenu.MenuItems.Add("Light Drizzle", new EventHandler(Weather_Btn)); weathers[6] = tray.trayMenu.MenuItems.Add("Drizzle", new EventHandler(Weather_Btn)); weathers[7] = tray.trayMenu.MenuItems.Add("Light Rain", new EventHandler(Weather_Btn)); weathers[8] = tray.trayMenu.MenuItems.Add("Rain", new EventHandler(Weather_Btn)); weathers[9] = tray.trayMenu.MenuItems.Add("Heavy Rain", new EventHandler(Weather_Btn)); weathers[10] = tray.trayMenu.MenuItems.Add("User Rain - 1", new EventHandler(Weather_Btn)); weathers[11] = tray.trayMenu.MenuItems.Add("User Rain - 2", new EventHandler(Weather_Btn)); weathers[12] = tray.trayMenu.MenuItems.Add("Light Snow", new EventHandler(Weather_Btn)); weathers[13] = tray.trayMenu.MenuItems.Add("Snow", new EventHandler(Weather_Btn)); weathers[14] = tray.trayMenu.MenuItems.Add("Heavy Snow", new EventHandler(Weather_Btn)); weathers[15] = tray.trayMenu.MenuItems.Add("Sleet", new EventHandler(Weather_Btn)); weathers[16] = tray.trayMenu.MenuItems.Add("Mist", new EventHandler(Weather_Btn)); weathers[17] = tray.trayMenu.MenuItems.Add("Haze", new EventHandler(Weather_Btn)); weathers[18] = tray.trayMenu.MenuItems.Add("Fog", new EventHandler(Weather_Btn)); weathers[19] = tray.trayMenu.MenuItems.Add("Dust", new EventHandler(Weather_Btn)); weathers[20] = tray.trayMenu.MenuItems.Add("User Atmosphere - 1", new EventHandler(Weather_Btn)); weathers[21] = tray.trayMenu.MenuItems.Add("User Atmosphere - 2", new EventHandler(Weather_Btn)); weather.MenuItems.AddRange(weathers); tray.trayMenu.MenuItems.Add(weather); tray.trayMenu.MenuItems.Add("-"); MenuItem clockType = new MenuItem("Clock Style"); gear_clock = tray.trayMenu.MenuItems.Add("Gear", new EventHandler(Clock_Btn)); circle_clock = tray.trayMenu.MenuItems.Add("Circle", new EventHandler(Clock_Btn)); simple_clock = tray.trayMenu.MenuItems.Add("Simple", new EventHandler(Clock_Btn)); clockType.MenuItems.Add(gear_clock); clockType.MenuItems.Add(circle_clock); clockType.MenuItems.Add(simple_clock); tray.trayMenu.MenuItems.Add(clockType); MenuItem uiColor = new MenuItem("UI Color"); auto_ui_color = tray.trayMenu.MenuItems.Add("Auto", new EventHandler(UI_Btn)); manual_ui_color = tray.trayMenu.MenuItems.Add("Pick One", new EventHandler(UI_Btn)); uiColor.MenuItems.Add(auto_ui_color); uiColor.MenuItems.Add(manual_ui_color); tray.trayMenu.MenuItems.Add(uiColor); tray.trayMenu.MenuItems.Add("-"); video = new MenuItem("Choose Wallpaper", new EventHandler(Video_Event)); tray.trayMenu.MenuItems.Add(video); tray.trayMenu.MenuItems.Add("-"); //trying stuff displaySetup = new MenuItem("Select Display"); int i = 0; //displaySetup.MenuItems.Add("Span", new EventHandler(UserDisplayMenu)); foreach (var item in System.Windows.Forms.Screen.AllScreens) { displaySetup.MenuItems.Add("Display " + i.ToString(), new EventHandler(UserDisplayMenu)); i++; } tray.trayMenu.MenuItems.Add(displaySetup); if (MenuController.menuController.isMultiMonitor == false) { displaySetup.Enabled = false; } /* * MenuItem displaySetup = new MenuItem("Multimonitor", new EventHandler(DisplayBtn)); * tray.trayMenu.MenuItems.Add(displaySetup); * if (MenuController.menuController.isMultiMonitor == false) * displaySetup.Enabled = false; */ startup = new MenuItem("Run at Startup", new EventHandler(System_Startup_Btn)); tray.trayMenu.MenuItems.Add(startup); tray.trayMenu.MenuItems.Add("-"); MenuItem website = new MenuItem("Project Website", new EventHandler(WebpageBtn)); tray.trayMenu.MenuItems.Add(website); MenuItem kofi = new MenuItem("Buy the Dev Coffee!", new EventHandler(KofiBtn)); tray.trayMenu.MenuItems.Add(kofi); tray.trayMenu.MenuItems.Add("-"); update = new MenuItem("Checking for update", new EventHandler(Update_Check)); tray.trayMenu.MenuItems.Add(update); update.Enabled = false; MenuItem settings = new MenuItem("Settings", new EventHandler(Settings_Launcher)); tray.trayMenu.MenuItems.Add(settings); tray.trayMenu.MenuItems.Add("-"); MenuItem close = new MenuItem("Exit", new EventHandler(Close_Action)); tray.trayMenu.MenuItems.Add(close); tray.trayIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(Settings_Launcher_Mouse); tray.ShowNotification(1000, "Hello..", "I'll just stay in systemtray, right click for more option..."); if (MenuController.menuController.userSettings.isDemo == true) //weather control { WeatherMenuEnable(true); } else { WeatherMenuEnable(false); } SetStartup(MenuController.menuController.userSettings.runAtStartup); //set startup entry // startup entry, checkmark btn if (MenuController.menuController.userSettings.runAtStartup == true) { SetStartup(true); //re adding incase filepath changes etc startup.Checked = true; } else { SetStartup(false); startup.Checked = false; } WeatherBtnCheckMark(); ClockCheckMark(); ColorCheckMark(); //CheckStartupRegistry(); //Events not working... unity intercepting them! //SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(OnPowerChange); //SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged; } }