예제 #1
0
        public NextMapViewModel()
        {
            NextMap = new NextMap();
            MapInfo = new Map();

            DownloadMapCommand = new DownloadMapCommand(this);

            if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
            {
                NextMap.Map      = "ze_potc_p4";
                NextMap.TimeLeft = "3:35";
            }
            else
            {
                var settings = new MapHandlerSettings
                {
                    FastdLinks    = Variables.Settings.FastdLinks.Select(x => x.Url).ToList(),
                    MapsDirectory = Variables.Settings.MapsDirectory
                };

                Mh = new MapHandler(settings);

                UpdateData(null, new EventArgs());
                _verificationLoop = new DispatcherTimer {
                    Interval = new TimeSpan(0, 0, 5)
                };
                _verificationLoop.Tick += UpdateData;
                _verificationLoop.Start();
            }
        }
예제 #2
0
        public MapsListingViewModel()
        {
            DownloadMapFilesCommand = new DownloadMapFilesCommand(this);
            UpdateMapInfoCommand    = new UpdateMapInfoCommand(this);
            SendDynamicCmdCommand   = new SendDynamicCmdCommand();

            Maps = new ObservableCollection <Map>();
            if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
            {
                Maps.Add(new Map()
                {
                    FullName          = "ze_licciana_pe",
                    CanDownload       = true,
                    AlreadyDownloaded = true,
                    DownloadableFiles = new List <MapFile>
                    {
                        new MapFile {
                            Name = "url1", Size = 535345
                        },
                        new MapFile {
                            Name = "url1", Size = 535345
                        },
                        new MapFile {
                            Name = "url1", Size = 535345
                        }
                    }
                });

                Maps.Add(new Map()
                {
                    FullName          = "ze_fapescape_p5",
                    CanDownload       = false,
                    AlreadyDownloaded = true,
                    DownloadableFiles = new List <MapFile>
                    {
                        new MapFile {
                            Name = "url1", Size = 535345
                        },
                        new MapFile {
                            Name = "url1", Size = 535345
                        },
                        new MapFile {
                            Name = "url1", Size = 535345
                        }
                    }
                });

                Maps.Add(new Map()
                {
                    FullName          = "ze_dust_pe",
                    CanDownload       = true,
                    AlreadyDownloaded = false,
                    DownloadableFiles = new List <MapFile>
                    {
                        new MapFile {
                            Name = "url1", Size = 535345
                        },
                        new MapFile {
                            Name = "url1", Size = 535345
                        },
                        new MapFile {
                            Name = "url1", Size = 535345
                        }
                    }
                });
            }
            else
            {
                var settings = new MapHandlerSettings
                {
                    FastdLinks    = Variables.Settings.FastdLinks.Select(x => x.Url).ToList(),
                    MapsDirectory = Variables.Settings.MapsDirectory
                };

                Mh = new MapHandler(settings);
                ReloadMaps();
            }
        }