Пример #1
0
        private void LoadReceiver()
        {
            LoadingMessage = "Connecting to device . . .";
            UI.Invoke(NotifyAll);

            var vm = new VMMain(TheController);

            DownloadDeviceImage();

            var images = new Dictionary <string, bool>();

            foreach (var z in vm.Zones)
            {
                foreach (var s in z.Scenes)
                {
                    images[s.ImageUri] = false;
                }
                foreach (var i in z.Inputs)
                {
                    images[i.ImageUri] = false;
                }
            }

            var all = images.Keys.ToList();

            if (all.Count < 0)
            {
                UI.Invoke(NotifyAll);
                return;
            }

            DownloadImages(new VMMain(TheController), all, images.Count, 0);
        }
Пример #2
0
        private void DownloadImages(VMMain vm, List <string> images, double totalImages, double imagesLoaded)
        {
            if (images.Count == 0)
            {
                PercentageLoaded = 1;
                LoadingMessage   = " ";
                IsLoading        = IsIndeterminate = InvalidDevice = false;
                SessionManager.SaveState(StartVM, () =>
                {
                    SessionManager.SaveState(vm, () => UI.Invoke(NotifyAll));
                });
                return;
            }

            var percentageComplete = (imagesLoaded / totalImages);

            UI.Invoke(() =>
            {
                IsIndeterminate  = false;
                LoadingMessage   = string.Format("Loading: {0}%", ((int)(percentageComplete * 100D)));
                PercentageLoaded = percentageComplete;
            });

            var img = images[0];

            images.RemoveAt(0);
            Factory.ImageCache.DownloadImage(img, () =>
            {
                DownloadImages(vm, images, totalImages, ++imagesLoaded);
            });
        }
Пример #3
0
 public VMSelectable(IController c, VMMain mainVM, string name, VMSelectableType type)
     : base(c)
 {
     DisplayName   = SelectString = name;
     MainVM        = mainVM;
     SelectionType = type;
 }
Пример #4
0
 public VMSelectable(IController c, VMMain mainVM, Input i)
     : this(c, mainVM)
 {
     SelectString  = GetSelectString(i);
     DisplayName   = i.Title;
     ImageUri      = GetImageUri(i, c);
     SelectionType = VMSelectableType.Input;
 }
Пример #5
0
 public VMSelectable(IController c, VMMain mainVM, Scene s)
     : this(c, mainVM)
 {
     SelectString  = GetSelectString(s);
     DisplayName   = s.DisplayName;
     ImageUri      = GetImageUri(s, c);
     SelectionType = VMSelectableType.Scene;
 }
Пример #6
0
 public VMSelectable(IController c, VMMain mainVM, Zone zone, string imageUri)
     : this(c, mainVM)
 {
     SelectString  = GetSelectString(zone);
     DisplayName   = zone.DisplayName;
     ImageUri      = imageUri;
     SelectionType = VMSelectableType.Zone;
 }
Пример #7
0
        public VMBrowse(VMMain main, Input i, Zone z)
            : base(main.TheController)
        {
            Input  = i;
            Zone   = z;
            MainVM = main;

            var source = main.TheController.Sources.FirstOrDefault(s => s.SourceName == i.Src_Name);

            if (source != null)
            {
                CanList = source.CanList;
            }
        }
Пример #8
0
        public VMList(VMMain main, Input i, Zone z)
            : base(main.TheController)
        {
            Input  = i;
            Zone   = z;
            _Items = new Dictionary <int, ListItem>();
            MainVM = main;

            var source = main.TheController.Sources.FirstOrDefault(s => s.SourceName == i.Src_Name);

            if (source != null)
            {
                CanList = source.CanList;
            }
        }
Пример #9
0
        public VMZone(VMMain main, Zone zone, IController c)
            : base(c, main, zone, null)
        {
            if (zone.Inputs != null)
            {
                Inputs = zone.Inputs.Select(i => new VMSelectable(TheController, main, i)).ToArray();
            }
            else
            {
                Inputs = new VMSelectable[0];
            }

            if (zone.Scenes != null)
            {
                Scenes = zone.Scenes.Select(s => new VMSelectable(TheController, main, s)).ToArray();
            }
            else
            {
                Scenes = new VMSelectable[0];
            }

            Volume   = new VMVolume(this, c);
            Playback = new VMPlayback(this);

            _DSPs = new VMSelectable[] {
                new VMSelectable(TheController, MainVM, Surround.DSP_Strait, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_Standard, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_Stereo_2CH, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_Stereo_7CH, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_SurroundDecoder, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_ActionGame, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_Adventure, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_CellarClub, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_Chamber, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_Drama, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_HallInMunich, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_HallInViena, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_MonoMovie, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_MusicVideo, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_RoleplayingGame, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_SciFi, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_Spectacle, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_Sports, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_TheBottomLine, VMSelectableType.DSP),
                new VMSelectable(TheController, MainVM, Surround.DSP_TheRoxyTheatre, VMSelectableType.DSP),
            };
            RefreshVM(zone);
        }
Пример #10
0
 protected VMSelectable(IController c, VMMain mainVM)
     : base(c)
 {
     MainVM = mainVM;
 }