Esempio n. 1
0
 private void _viewModel_EnhancedPropertyChanged(object sender, EnhancedPropertyChangedEventArgs <IDirectoryController> e)
 {
     if (e.IsProperty(p => p.CurrentDirectory))
     {
         NavigateTo(_viewModel.CurrentDirectory);
     }
 }
Esempio n. 2
0
 private void Profile_EnhancedPropertyChanged(object sender, EnhancedPropertyChangedEventArgs <UserProfile> e)
 {
     if (e.IsProperty(p => p.HasChanges))
     {
         UpdateWindowTitle();
     }
 }
Esempio n. 3
0
 private void TagAlbumViewModel_EnhancedPropertyChanged(object sender, EnhancedPropertyChangedEventArgs <TagAlbumViewModel> e)
 {
     if (e.IsProperty(p => p.SelectedTrackIndex))
     {
         SelectedTrack = Album.Tracks[SelectedTrackIndex];
     }
 }
Esempio n. 4
0
 private void TagViewModel_EnhancedPropertyChanged(object sender, EnhancedPropertyChangedEventArgs <ITagViewModel> e)
 {
     if (e.IsProperty(p => p.DirectoryViewModel))
     {
         DirectoryViewModel.InitialDirectory = @"C:\";
     }
 }
Esempio n. 5
0
 private void Profile_EnhancedPropertyChanged(object sender, EnhancedPropertyChangedEventArgs <UserProfile> e)
 {
     if (e.IsProperty(p => p.ProfileName))
     {
         _confirmedOverwrite = false;
     }
 }
Esempio n. 6
0
        private void FileNaming_EnhancedPropertyChanged(object sender, EnhancedPropertyChangedEventArgs <FileNaming> e)
        {
            if (e.IsProperty(p => p.UseLatinCharactersOnly) ||
                e.IsProperty(p => p.UseStandardCharactersOnly))
            {
                UpdateResults();
            }
            else if (e.IsProperty(p => p.UseUnderscores))
            {
                List <FormatItem> list = new List <FormatItem>();
                list.AddRange(_directoryFormats);
                list.AddRange(_audioFileFormats);

                bool useUnderscores = (bool)e.NewValue;
                foreach (var item in list)
                {
                    if (useUnderscores)
                    {
                        item.FormatString = item.FormatString.Replace("> - <", ">-<");
                        item.FormatString = item.FormatString.Replace("> - (", ">-(");
                        item.FormatString = item.FormatString.Replace(") - <", ")-<");
                    }
                    else
                    {
                        item.FormatString = item.FormatString.Replace(">-<", "> - <");
                        item.FormatString = item.FormatString.Replace(">-(", "> - (");
                        item.FormatString = item.FormatString.Replace(")-<", ") - <");
                    }
                }

                UpdateResults();
            }
        }
Esempio n. 7
0
 private void DirectoryController_EnhancedPropertyChanged(object sender, EnhancedPropertyChangedEventArgs <IDirectoryController> e)
 {
     if (e.IsProperty(p => p.TypingDirectory))
     {
         //SubDirectories = new ObservableCollection<string>();
         GetSubDirectories(TypingDirectory);
     }
 }
Esempio n. 8
0
 private void FileNaming_EnhancedPropertyChanged(object sender, EnhancedPropertyChangedEventArgs <FileNaming> e)
 {
     if (e.IsProperty(p => p.UseStandardCharactersOnly))
     {
         if (UseStandardCharactersOnly)
         {
             _savedUseLatinCharactersOnly = UseLatinCharactersOnly;
             UseLatinCharactersOnly       = true;
         }
         else
         {
             UseLatinCharactersOnly = _savedUseLatinCharactersOnly;
         }
     }
 }
Esempio n. 9
0
        private void _directoryController_EnhancedPropertyChanged(object sender, EnhancedPropertyChangedEventArgs <IDirectoryController> e)
        {
            // TODO: Move to DirectoryButtons

            /*if (DirectoryComboBox.IsSelectionBoxHighlighted)
             * {
             *  if (e.IsProperty(p => p.SubDirectories))
             *  {
             *      if (_directoryController.SubDirectories == null || _directoryController.SubDirectories.Count == 0)
             *      {
             *          DirectoryComboBox.IsDropDownOpen = false;
             *      }
             *      else
             *      {
             *          DirectoryComboBox.IsDropDownOpen = true;
             *      }
             *  }
             * }*/
        }
Esempio n. 10
0
        private void EditProfileViewModel_EnhancedPropertyChanged(object sender, EnhancedPropertyChangedEventArgs <EditProfileViewModel> e)
        {
            if (e.IsProperty(p => p.Profile))
            {
                UserProfile oldValue = e.OldValue as UserProfile;
                if (oldValue != null)
                {
                    oldValue.EnhancedPropertyChanged -= Profile_EnhancedPropertyChanged;
                }

                UserProfile newValue = e.NewValue as UserProfile;
                if (newValue != null)
                {
                    newValue.EnhancedPropertyChanged -= Profile_EnhancedPropertyChanged;
                    newValue.EnhancedPropertyChanged += Profile_EnhancedPropertyChanged;
                    newValue.CheckHasChanges();
                }

                UpdateWindowTitle();
            }
        }
Esempio n. 11
0
        private void _viewModel_EnhancedPropertyChanged(object sender, EnhancedPropertyChangedEventArgs <IDirectoryController> e)
        {
            if (e.IsProperty(p => p.CurrentDirectory))
            {
                string directory = _viewModel.CurrentDirectory;
                if (Directory.Exists(directory))
                {
                    ButtonGrid.Children.Clear();
                    ButtonGrid.ColumnDefinitions.Clear();

                    List <UIElement> buttons = new List <UIElement>();

                    string curdir = directory;
                    while (Directory.Exists(curdir))
                    {
                        if (curdir.EndsWith(@"\") && curdir.Length > 3)
                        {
                            curdir = curdir.Substring(0, curdir.Length - 1);
                        }

                        MenuItem menuItem;
                        Menu     menu;
                        GetMenuItem(curdir, directory, out menuItem, out menu);

                        if (menu != null)
                        {
                            buttons.Add(menu);
                        }

                        Button dirButton = new Button();
                        dirButton.Content =
                            new TextBlock
                        {
                            Text   = curdir.Length <= 3 ? DriveTypeHelper.GetDescription(new DriveInfo(curdir.Substring(0, 2))) : Path.GetFileName(curdir),
                            Margin = new Thickness(2, 0, 2, 0)
                        };

                        dirButton.VerticalAlignment        = VerticalAlignment.Stretch;
                        dirButton.VerticalContentAlignment = VerticalAlignment.Center;
                        dirButton.Tag    = curdir;
                        dirButton.Click += (s, be) => { _viewModel.CurrentDirectory = (string)((Button)s).Tag; };
                        dirButton.Style  = (Style)Application.Current.Resources["DirectoryButton"];
                        buttons.Add(dirButton);

                        if (menuItem != null)
                        {
                            dirButton.MouseEnter += delegate
                            {
                                if (!menuItem.IsSubmenuOpen)
                                {
                                    VisualStateManager.GoToState(menuItem, "MouseOver", true);
                                }
                            };
                            menuItem.MouseEnter += delegate
                            {
                                if (!menuItem.IsSubmenuOpen)
                                {
                                    VisualStateManager.GoToState(dirButton, "MenuMouseOver", true);
                                    VisualStateManager.GoToState(menuItem, "MouseOver", true);
                                }
                            };

                            dirButton.MouseLeave += delegate
                            {
                                if (!menuItem.IsMouseOver && !menuItem.IsSubmenuOpen)
                                {
                                    VisualStateManager.GoToState(menuItem, "Normal", true);
                                }
                            };
                            menuItem.MouseLeave += delegate
                            {
                                if (!dirButton.IsMouseOver && !menuItem.IsSubmenuOpen)
                                {
                                    VisualStateManager.GoToState(dirButton, "Normal", true);
                                    VisualStateManager.GoToState(menuItem, "Normal", true);
                                }
                            };

                            menuItem.SubmenuOpened += delegate
                            {
                                VisualStateManager.GoToState(dirButton, "Pressed", true);
                                VisualStateManager.GoToState(menuItem, "Pressed", true);
                            };

                            menuItem.SubmenuClosed += delegate
                            {
                                if (!dirButton.IsMouseOver && !menuItem.IsMouseOver)
                                {
                                    VisualStateManager.GoToState(dirButton, "Normal", true);
                                    VisualStateManager.GoToState(menuItem, "Normal", true);
                                }
                                else
                                {
                                    VisualStateManager.GoToState(dirButton, "MouseOver", true);
                                    VisualStateManager.GoToState(menuItem, "MouseOver", true);
                                }
                            };
                        }

                        curdir = Path.GetDirectoryName(curdir);
                    }

                    MenuItem rootMenuItem;
                    Menu     rootMenu;
                    GetMenuItem(curdir, directory, out rootMenuItem, out rootMenu);
                    rootMenuItem.MouseEnter += delegate
                    {
                        if (!rootMenuItem.IsSubmenuOpen)
                        {
                            VisualStateManager.GoToState(rootMenuItem, "MouseOver", true);
                        }
                    };

                    rootMenuItem.MouseLeave += delegate
                    {
                        if (!rootMenuItem.IsSubmenuOpen)
                        {
                            VisualStateManager.GoToState(rootMenuItem, "Normal", true);
                        }
                    };

                    rootMenuItem.SubmenuOpened += delegate
                    {
                        VisualStateManager.GoToState(rootMenuItem, "Pressed", true);
                    };

                    rootMenuItem.SubmenuClosed += delegate
                    {
                        if (!rootMenuItem.IsMouseOver)
                        {
                            VisualStateManager.GoToState(rootMenuItem, "Normal", true);
                        }
                        else
                        {
                            VisualStateManager.GoToState(rootMenuItem, "MouseOver", true);
                        }
                    };


                    buttons.Add(rootMenu);

                    FileView currentFileView = new FileView(directory);
                    buttons.Add(new Image {
                        Source = currentFileView.ImageSource, Margin = new Thickness(3, 3, 3, 3), VerticalAlignment = VerticalAlignment.Center
                    });

                    for (int i = buttons.Count - 1, j = 0; i >= 0; i--, j++)
                    {
                        ButtonGrid.ColumnDefinitions.Add(new ColumnDefinition {
                            Width = GridLength.Auto
                        });
                        buttons[i].SetValue(Grid.ColumnProperty, j);
                        ButtonGrid.Children.Add(buttons[i]);
                    }
                }
            }
        }
Esempio n. 12
0
 private void _viewModel_EnhancedPropertyChanged(object sender, EnhancedPropertyChangedEventArgs<IDirectoryController> e)
 {
     if (e.IsProperty(p => p.CurrentDirectory))
     {
         NavigateTo(_viewModel.CurrentDirectory);
     }
 }
Esempio n. 13
0
        private void _viewModel_EnhancedPropertyChanged(object sender, EnhancedPropertyChangedEventArgs<IDirectoryController> e)
        {
            if (e.IsProperty(p => p.CurrentDirectory))
            {
                string directory = _viewModel.CurrentDirectory;
                if (Directory.Exists(directory))
                {
                    ButtonGrid.Children.Clear();
                    ButtonGrid.ColumnDefinitions.Clear();

                    List<UIElement> buttons = new List<UIElement>();

                    string curdir = directory;
                    while (Directory.Exists(curdir))
                    {
                        if (curdir.EndsWith(@"\") && curdir.Length > 3)
                            curdir = curdir.Substring(0, curdir.Length - 1);

                        MenuItem menuItem;
                        Menu menu;
                        GetMenuItem(curdir, directory, out menuItem, out menu);

                        if (menu != null)
                        {
                            buttons.Add(menu);
                        }

                        Button dirButton = new Button();
                        dirButton.Content =
                            new TextBlock
                            {
                                Text = curdir.Length <= 3 ? DriveTypeHelper.GetDescription(new DriveInfo(curdir.Substring(0, 2))) : Path.GetFileName(curdir),
                                Margin = new Thickness(2, 0, 2, 0)
                            };

                        dirButton.VerticalAlignment = VerticalAlignment.Stretch;
                        dirButton.VerticalContentAlignment = VerticalAlignment.Center;
                        dirButton.Tag = curdir;
                        dirButton.Click += (s, be) => { _viewModel.CurrentDirectory = (string)((Button)s).Tag; };
                        dirButton.Style = (Style)Application.Current.Resources["DirectoryButton"];
                        buttons.Add(dirButton);

                        if (menuItem != null)
                        {
                            dirButton.MouseEnter += delegate
                            {
                                if (!menuItem.IsSubmenuOpen)
                                {
                                    VisualStateManager.GoToState(menuItem, "MouseOver", true);
                                }
                            };
                            menuItem.MouseEnter += delegate
                            {
                                if (!menuItem.IsSubmenuOpen)
                                {
                                    VisualStateManager.GoToState(dirButton, "MenuMouseOver", true);
                                    VisualStateManager.GoToState(menuItem, "MouseOver", true);
                                }
                            };

                            dirButton.MouseLeave += delegate
                            {
                                if (!menuItem.IsMouseOver && !menuItem.IsSubmenuOpen)
                                {
                                    VisualStateManager.GoToState(menuItem, "Normal", true);
                                }
                            };
                            menuItem.MouseLeave += delegate
                            {
                                if (!dirButton.IsMouseOver && !menuItem.IsSubmenuOpen)
                                {
                                    VisualStateManager.GoToState(dirButton, "Normal", true);
                                    VisualStateManager.GoToState(menuItem, "Normal", true);
                                }
                            };

                            menuItem.SubmenuOpened += delegate
                            {
                                VisualStateManager.GoToState(dirButton, "Pressed", true);
                                VisualStateManager.GoToState(menuItem, "Pressed", true);
                            };

                            menuItem.SubmenuClosed += delegate
                            {
                                if (!dirButton.IsMouseOver && !menuItem.IsMouseOver)
                                {
                                    VisualStateManager.GoToState(dirButton, "Normal", true);
                                    VisualStateManager.GoToState(menuItem, "Normal", true);
                                }
                                else
                                {
                                    VisualStateManager.GoToState(dirButton, "MouseOver", true);
                                    VisualStateManager.GoToState(menuItem, "MouseOver", true);
                                }
                            };
                        }

                        curdir = Path.GetDirectoryName(curdir);
                    }

                    MenuItem rootMenuItem;
                    Menu rootMenu;
                    GetMenuItem(curdir, directory, out rootMenuItem, out rootMenu);
                    rootMenuItem.MouseEnter += delegate
                    {
                        if (!rootMenuItem.IsSubmenuOpen)
                            VisualStateManager.GoToState(rootMenuItem, "MouseOver", true);
                    };

                    rootMenuItem.MouseLeave += delegate
                    {
                        if (!rootMenuItem.IsSubmenuOpen)
                        {
                            VisualStateManager.GoToState(rootMenuItem, "Normal", true);
                        }
                    };

                    rootMenuItem.SubmenuOpened += delegate
                    {
                        VisualStateManager.GoToState(rootMenuItem, "Pressed", true);
                    };

                    rootMenuItem.SubmenuClosed += delegate
                    {
                        if (!rootMenuItem.IsMouseOver)
                        {
                            VisualStateManager.GoToState(rootMenuItem, "Normal", true);
                        }
                        else
                        {
                            VisualStateManager.GoToState(rootMenuItem, "MouseOver", true);
                        }
                    };

                    buttons.Add(rootMenu);

                    FileView currentFileView = new FileView(directory);
                    buttons.Add(new Image { Source = currentFileView.ImageSource, Margin = new Thickness(3, 3, 3, 3), VerticalAlignment = VerticalAlignment.Center });

                    for (int i = buttons.Count - 1, j = 0; i >= 0; i--, j++)
                    {
                        ButtonGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
                        buttons[i].SetValue(Grid.ColumnProperty, j);
                        ButtonGrid.Children.Add(buttons[i]);
                    }
                }
            }
        }
Esempio n. 14
0
        private void NewProfileViewModel_EnhancedPropertyChanged(object sender, EnhancedPropertyChangedEventArgs <NewProfileViewModel> e)
        {
            if (e.IsProperty(p => p.CreateNFO))
            {
                if (!CreateNFO)
                {
                    _storedCreateSampleNFO = CreateSampleNFO;
                    _storedHasExistingNFO  = HasExistingNFO;

                    CreateSampleNFO = false;
                    HasExistingNFO  = false;
                }
                else
                {
                    CreateSampleNFO = _storedCreateSampleNFO;
                    HasExistingNFO  = _storedHasExistingNFO;
                }
            }
            else if (e.IsProperty(p => p.CreateSampleNFO))
            {
                if (CreateSampleNFO)
                {
                    HasExistingNFO = false;
                }
            }
            else if (e.IsProperty(p => p.HasExistingNFO))
            {
                if (HasExistingNFO)
                {
                    CreateSampleNFO = false;
                }
            }
            else if (e.IsProperty(p => p.PageIndex))
            {
                if (PageIndex == 0)
                {
                    CurrentVisualState = PageOneStateName;
                }
                else if (PageIndex == 1)
                {
                    CurrentVisualState = PageTwoStateName;
                }
            }
            else if (e.IsProperty(p => p.CurrentVisualState))
            {
                if (CurrentVisualState == PageOneStateName)
                {
                    IsProfileNameFocused = true;
                }
            }
            else if (e.IsProperty(p => p.DirectoryFormat) || e.IsProperty(p => p.AudioFileFormat))
            {
                var oldFormatItem = e.OldValue as FormatItem;
                if (oldFormatItem != null)
                {
                    oldFormatItem.IsSelected = false;
                }
                var newFormatItem = e.NewValue as FormatItem;
                if (newFormatItem != null)
                {
                    newFormatItem.IsSelected = true;
                }

                if (newFormatItem == null && oldFormatItem != null)
                {
                    if (e.IsProperty(p => p.DirectoryFormat))
                    {
                        DirectoryFormat = oldFormatItem;
                    }
                    else if (e.IsProperty(p => p.AudioFileFormat))
                    {
                        AudioFileFormat = oldFormatItem;
                    }
                }
            }
        }
Esempio n. 15
0
 private void _directoryController_EnhancedPropertyChanged(object sender, EnhancedPropertyChangedEventArgs<IDirectoryController> e)
 {
     // TODO: Move to DirectoryButtons
     /*if (DirectoryComboBox.IsSelectionBoxHighlighted)
     {
         if (e.IsProperty(p => p.SubDirectories))
         {
             if (_directoryController.SubDirectories == null || _directoryController.SubDirectories.Count == 0)
             {
                 DirectoryComboBox.IsDropDownOpen = false;
             }
             else
             {
                 DirectoryComboBox.IsDropDownOpen = true;
             }
         }
     }*/
 }