/// <summary> /// Background appear tween animation, do any animation changes here /// </summary> /// <param name="background"></param> private static void Appear(this WindowBackground background) { //background.img.gameObject.SetActive(false);//disable on start (doublecheck) var imgColor = background.img.color; imgColor.a = AlphaMin; background.img.color = imgColor; background.img.gameObject.SetActive(true); background.img.DoFade(AlphaMax, BackgroundAppearTime); }
/// <summary> /// Window background tween hide animation, do any changes to animation here /// </summary> /// <param name="background"></param> private static void Hide(this WindowBackground background) { background.img.DoFade(AlphaMin, BackgroundHideTime, () => background.img.gameObject.SetActive(false)); }
void KListener_KeyDown(object sender, RawKeyEventArgs args) { if (alt && args.Key == Key.S && !ctrl && !shift) { WindowBackground.Dispatcher.Invoke(() => { var hwnd = new WindowInteropHelper(Application.Current.MainWindow).Handle; if (WindowBackground.ToString() == "#00FFFFFF") { WindowsServices.SetWindowExLayered(hwnd); WindowBackground = new SolidColorBrush(Color.FromArgb(0x01, 0, 0, 0)); } else if (WindowBackground.ToString() == "#01000000") { WindowsServices.SetWindowExTransparent(hwnd); WindowBackground = new SolidColorBrush(Colors.Transparent); } }); SetMode = !SetMode; } else if (SetMode && args.Key == Key.E && !ctrl && !alt && !shift) { string time = ((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds().ToString(); WindowBackground.Dispatcher.Invoke(() => { if (!SystemType.SourceName.Contains("ERAM")) { SystemType = new NexradTileLayer { SourceName = "ERAM" + time, Description = "© [Srinath Nandakumar & Iowa State University](http://mesonet.agron.iastate.edu/)", TileSource = new TileSource { UriFormat = "https://web.ics.purdue.edu/~snandaku/atc/processor.php?x={x}&y={y}&z={z}" }, UpdateWhileViewportChanging = true, MinZoomLevel = 6, MaxZoomLevel = 11 }; Orientation = 0; Boundary = null; } }); } else if (SetMode && args.Key == Key.S && !ctrl && !alt && !shift) { string time = ((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds().ToString(); WindowBackground.Dispatcher.Invoke(() => { if (!SystemType.SourceName.Contains("STARS")) { SystemType = new NexradTileLayer { SourceName = "STARS" + time, Description = "© [Srinath Nandakumar & Iowa State University](http://mesonet.agron.iastate.edu/)", TileSource = new TileSource { UriFormat = "https://web.ics.purdue.edu/~snandaku/atc/processorS.php?x={x}&y={y}&z={z}" }, UpdateWhileViewportChanging = true, MinZoomLevel = 8, MaxZoomLevel = 13 }; Orientation = -15; Boundary = null; } }); } else if (args.Key == Key.B && !ctrl && alt && !shift) { WindowBackground.Dispatcher.Invoke(() => { if (SystemType.SourceName.Contains("STARS")) { if (Boundary == null) { Boundary = NCT; } else if (Boundary == NCT) { Boundary = RNO; } else if (Boundary == RNO) { Boundary = FAT; } else if (Boundary == FAT) { Boundary = null; } } if (SystemType.SourceName.Contains("ERAM")) { if (Boundary == null) { Boundary = ZOA; } else if (Boundary == ZOA) { Boundary = null; } } }); } else if (alt && args.Key == Key.Up && !ctrl && !shift) { if (Brite < 1) { Brite += 0.05; } } else if (alt && args.Key == Key.Down && !ctrl && !shift) { if (Brite > 0) { Brite -= 0.05; } } else if (!alt && args.Key == Key.M && ctrl && shift) { if (State == WindowState.Maximized) { State = WindowState.Minimized; } else if (State == WindowState.Minimized) { State = WindowState.Maximized; } } else if (!alt && args.Key == Key.X && ctrl && shift) { WindowBackground.Dispatcher.Invoke(() => { Application.Current.Shutdown(); }); } else if (args.Key == Key.LeftCtrl || args.Key == Key.RightCtrl) { ctrl = true; } else if (args.Key == Key.LeftShift || args.Key == Key.RightShift) { shift = true; } else if (args.Key == Key.LeftAlt || args.Key == Key.RightAlt) { alt = true; } }