예제 #1
0
        private void SetVideo(string pathToImage)
        {
            // Check if there is an mp4 or Flv.
            // If none exists then use the original image path instead.
            var videoPath = pathToImage.Replace(".png", ".mp4");

            if (!File.Exists(videoPath))
            {
                videoPath = videoPath.Replace(".mp4", ".flv");

                if (!File.Exists(videoPath))
                {
                    if (File.Exists(pathToImage))
                    {
                        IsImageSource              = true;
                        currentImagePath           = pathToImage;
                        MediaPaneHeader           += " | " + Path.GetFileName(pathToImage);
                        _selectedService.GameImage = SelectedService.SetBitmapFromUri(new Uri(pathToImage));
                        WheelSource   = _selectedService.GameImage;
                        IsVideoSource = false;
                    }
                }
                else
                {
                    SetVideoSource(videoPath);
                }
            }
            else
            {
                SetVideoSource(videoPath);
            }
        }
예제 #2
0
        private void SetMediaForGameHs(string[] selectedOptions)
        {
            WheelSource   = null;
            VideoSource   = null;
            IsVideoSource = false;
            IsImageSource = false;
            IsPdf         = false;

            var hsPath  = _settingsRepo.HypermintSettings.HsPath;
            var romName = selectedOptions[0];

            _selectedService.CurrentRomname = romName;

            MediaPaneHeader = "Media View: " + selectedOptions[1];

            var mediaTypePath = Images.Wheels;

            if (!string.IsNullOrEmpty(selectedOptions[1]))
            {
                mediaTypePath = GetMediaPath(selectedOptions[1]);
            }

            //Set the image path TODO: Adjust for Multi-System
            var imagePath = Path.Combine(hsPath, Root.Media, _selectedService.CurrentSystem, mediaTypePath, romName + ".png");

            if (selectedOptions[1] == "Videos")
            {
                SetVideo(imagePath);
                return;
            }

            if (selectedOptions[1].Contains("Sound") || selectedOptions[1] == "MusicBg")
            {
                if (selectedOptions[1] == "Wheel Sounds")
                {
                    return;
                }
                else
                {
                    SetSound(imagePath);
                    return;
                }
            }

            if (!File.Exists(imagePath))
            {
                WheelSource   = _selectedService.SystemImage;
                IsImageSource = true;
            }
            else
            {
                IsImageSource              = true;
                currentImagePath           = imagePath;
                _selectedService.GameImage =
                    SelectedService.SetBitmapFromUri(new Uri(imagePath));
                WheelSource = _selectedService.GameImage;

                MediaPaneHeader += " | " + Path.GetFileName(imagePath) + " W:" + Math.Round(WheelSource.Width) + " H:" + Math.Round(WheelSource.Height);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DeviceServicesPageViewModel" /> class.
        /// </summary>
        public ServicePageViewModel()
        {
            if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
            {
            }

            this.PropertyChanged += ServicePageViewModel_PropertyChanged;

            Notify   = SelectedService.IsNotifySet();
            Indicate = SelectedService.IsIndicateSet();
        }
        public SimpleWheelViewModel(ISelectedService selectedService, IEventAggregator ea)
        {
            _selectedService = selectedService;
            _eventAggregator = ea;

            Patterns = Enum.GetNames(typeof(WheelCreator.Patterns));

            _eventAggregator.GetEvent <GenerateWheelEvent>().Subscribe(x =>
            {
                //GenerateWheelSource = new BitmapImage(new Uri(Path.GetFullPath(x)));
                GenerateWheelSource = SelectedService.SetBitmapFromUri(new Uri(Path.GetFullPath(x)));
            });
        }
예제 #5
0
        public void Generate()
        {
            try
            {
                IsError = false;
                Result  = SelectedService.Generate();

                if (!String.IsNullOrEmpty(Result))
                {
                    History.Insert(0, new HistoryRecord {
                        Text = Result, Timestamp = DateTime.Now
                    });
                    SelectedHistoryRecord = History.FirstOrDefault();
                }
            }
            catch (InvalidOperationException ex)
            {
                IsError      = true;
                ErrorMessage = ex.Message;
            }
        }
예제 #6
0
        private void SetImageWheelPreview(string imagePath)
        {
            WheelSource   = null;
            VideoSource   = null;
            IsVideoSource = false;

            if (File.Exists(imagePath))
            {
                IsImageSource = true;

                var fullpath = Path.GetFullPath(imagePath);

                currentImagePath = fullpath;

                _selectedService.GameImage =
                    SelectedService.SetBitmapFromUri(new Uri(currentImagePath));
                WheelSource = _selectedService.GameImage;

                MediaPaneHeader = "Media View | " + currentImagePath + " W:" + Math.Round(WheelSource.Width) + " H:" + Math.Round(WheelSource.Height);
            }
        }
        public string UpdateSelectedService(SelectedService sservice)
        {
            try
            {
                var entity = dbcontext.SelectedServices.Find(sservice.SelectedServiceId);

                if (entity != null)
                {
                    entity.SelectedServiceId = sservice.SelectedServiceId;
                    // entity.IsActive = brand.IsActive;
                    dbcontext.SaveChanges();

                    return("Updated");
                }

                return("null");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
        /// <summary>
        /// Service view model changed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void ServicePageViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "Notify")
            {
                if (Notify == true)
                {
                    NotifyProgress = true;
                    bool success = await SelectedService.TurnOnAllNotifications();

                    NotifyProgress = false;
                    if (success == true)
                    {
                        NotifyError = false;
                    }
                    else
                    {
                        Notify      = false;
                        NotifyError = true;
                    }
                }
                else
                {
                    NotifyProgress = true;
                    bool success = await SelectedService.TurnOffAllNotifications();

                    NotifyProgress = false;
                    if (success == true)
                    {
                        NotifyError = false;
                    }
                    else
                    {
                        NotifyError = true;
                        Notify      = true;
                    }
                }
            }

            if (e.PropertyName == "Indicate")
            {
                if (Indicate == true)
                {
                    IndicateProgress = true;
                    bool success = await SelectedService.TurnOnAllIndications();

                    IndicateProgress = false;
                    if (success == true)
                    {
                        IndicateError = false;
                    }
                    else
                    {
                        Indicate      = false;
                        IndicateError = true;
                    }
                }
                else
                {
                    IndicateProgress = true;
                    bool success = await SelectedService.TurnOffAllNotifications();

                    IndicateProgress = false;

                    if (success == true)
                    {
                        IndicateError = false;
                    }
                    else
                    {
                        IndicateError = true;
                        Indicate      = true;
                    }
                }
            }
        }
예제 #9
0
 public string UpdateSelectedService(SelectedService sservice)
 {
     return(_ISelectedService.UpdateSelectedService(sservice));
 }