예제 #1
0
        public ViewModel()
        {
            var timer = new DispatcherTimer();

            _boundary         = null;
            _windowBackground = new SolidColorBrush(Color.FromArgb(0x01, 0, 0, 0));
            ctrl    = false;
            shift   = false;
            alt     = false;
            SetMode = true;

            KListener.KeyDown += new RawKeyEventHandler(KListener_KeyDown);
            KListener.KeyUp   += new RawKeyEventHandler(KListener_KeyUp);
            Brite              = 0.5;

            SystemType = new NexradTileLayer
            {
                SourceName  = "ERAM",
                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 = 7,
                MaxZoomLevel = 11
            };
            //https://wms.chartbundle.com/tms/1.0.0/sec/{z}/{x}/{y}.png?origin=nw
            timer.Interval = TimeSpan.FromSeconds(300);
            timer.Tick    += timer_Tick;
            timer.Start();

            Orientation = 0;

            State = WindowState.Maximized;
        }
예제 #2
0
        public void RefreshTiles()
        {
            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
                    };
                }
                else 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
                    };
                }
            });

            Console.WriteLine(SystemType.SourceName);
        }
예제 #3
0
        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;
            }
        }