예제 #1
0
        public EpisodeList()
        {
            InitializeComponent();

            IsEpisodeSelected    = false;
            CurrentEpisodeNumber = 0;

            cboAvailableEpisodes.Items.Clear();
            int idx = 0;

            for (int i = 0; i < VM_AvailableEpisodeTypeContainer.GetAll().Count; i++)
            {
                VM_AvailableEpisodeTypeContainer cont = VM_AvailableEpisodeTypeContainer.GetAll()[i];
                cboAvailableEpisodes.Items.Add(cont);
                if (cont.AvailableEpisodeType == AppSettings.Episodes_Availability)
                {
                    idx = i;
                }
            }
            cboAvailableEpisodes.SelectedIndex = idx;

            cboWatched.Items.Clear();
            idx = 0;
            for (int i = 0; i < VM_WatchedStatusContainer.GetAll().Count; i++)
            {
                VM_WatchedStatusContainer cont = VM_WatchedStatusContainer.GetAll()[i];
                cboWatched.Items.Add(cont);
                if (cont.WatchedStatus == AppSettings.Episodes_WatchedStatus)
                {
                    idx = i;
                }
            }
            cboWatched.SelectedIndex = idx;

            Loaded += new RoutedEventHandler(EpisodeList_Loaded);
            cboEpisodeTypeFilter.SelectionChanged += new SelectionChangedEventHandler(cboEpisodeTypeFilter_SelectionChanged);
            cboAvailableEpisodes.SelectionChanged += new SelectionChangedEventHandler(cboAvailableEpisodes_SelectionChanged);
            cboWatched.SelectionChanged           += new SelectionChangedEventHandler(cboWatched_SelectionChanged);

            CurrentEpisodes     = new ObservableCollection <VM_AnimeEpisode_User>();
            CurrentEpisodeTypes = new ObservableCollection <VM_AnimeEpisodeType>();

            DataContextChanged += new DependencyPropertyChangedEventHandler(EpisodeList_DataContextChanged);
            //lbEpisodes.SelectionChanged += new SelectionChangedEventHandler(lbEpisodes_SelectionChanged);
            lbEpisodes.SelectedItemChanged += lbEpisodes_SelectedItemChanged;
            lbEpisodes.MouseDoubleClick    += new MouseButtonEventHandler(lbEpisodes_MouseDoubleClick);

            btnMarkAllWatched.Click         += new RoutedEventHandler(btnMarkAllWatched_Click);
            btnMarkAllUnwatched.Click       += new RoutedEventHandler(btnMarkAllUnwatched_Click);
            btnMarkAllPreviousWatched.Click += new RoutedEventHandler(btnMarkAllPreviousWatched_Click);

            lbEpisodes.PreviewMouseWheel += LbEpisodes_PreviewMouseWheel;
        }
예제 #2
0
        void cboWatched_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox cbo = (ComboBox)sender;

            object obj = cbo.SelectedItem;

            if (obj == null)
            {
                return;
            }

            try
            {
                VM_WatchedStatusContainer epcont = cbo.SelectedItem as VM_WatchedStatusContainer;
                AppSettings.Episodes_WatchedStatus = epcont.WatchedStatus;

                RefreshEpisodes();
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }