Exemplo n.º 1
0
        private void AppMainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            foreach (Engine engine in App.EngineController.Engines)
            {
                TabItem newtab = new TabItem();
                newtab.Header = engine.EngineName;
                PreviewViewmodel newPreviewViewmodel = new PreviewViewmodel(engine);
                Debug.WriteLine(engine, "Creating viewmodel for");
                var evm = new EngineViewmodel(engine);
                Debug.WriteLine(engine, "Creating commands for");
                evm.PreviewViewmodel = newPreviewViewmodel;
                newtab.Content = evm.View;
                tcChannels.Items.Add(newtab);

                Debug.WriteLine(engine.MediaManager, "Creating tab for");
                TabItem tabIngest = new TabItem();
                tabIngest.Header = engine.EngineName + " - Media";
                MediaManagerView newMediaManagerView = new MediaManagerView();
                MediaManagerViewmodel newMediaManagerViewmodel = new MediaManagerViewmodel(engine.MediaManager, newPreviewViewmodel);
                newMediaManagerView.DataContext = newMediaManagerViewmodel;
                tabIngest.Content = newMediaManagerView;
                tcChannels.Items.Add(tabIngest);

                //Debug.WriteLine(engine.Templates, "Creating tab for");
                //TabItem tabTemplates = new TabItem();
                //tabTemplates.Header = engine.EngineName + " - Animacje";
                //TemplatesView newTemplatesView = new TemplatesView();
                //TemplatesViewmodel newTemplatesViewmodel = new TemplatesViewmodel(engine);
                //newTemplatesView.DataContext = newTemplatesViewmodel;
                //tabTemplates.Content = newTemplatesView;
                //tcChannels.Items.Add(tabTemplates);
            }
            tcChannels.SelectedIndex = 0;
        }
Exemplo n.º 2
0
 public EventViewmodel(Server.Engine engine, EngineViewmodel engineViewmodel)
 {
     _engine = engine;
     engine.EventSaved += _onEventSaved;
     _engineViewmodel = engineViewmodel;
     _root = this;
     _level = 0;
     _isExpanded = true;
     foreach (Event se in engine.RootEvents.ToList())
         _addRootEvent(se);
 }
Exemplo n.º 3
0
 private EventViewmodel(Event aEvent, EventViewmodel parent)
 {
     if (aEvent == null) // dummy child
         return;
     _event = aEvent;
     _parent = parent;
     _root = parent._root;
     _engineViewmodel = parent._engineViewmodel;
     _level = (_parent == null) ? 0 : _parent._level + 1;
     if (aEvent.SubEvents.Count() > 0)
         _childrens.Add(DummyChild);
     _event.PropertyChanged += _onPropertyChanged;
     _event.Deleted += _eventDeleted;
     _event.SubEventChanged += _onSubeventChanged;
     _event.Relocated += _onRelocated;
     Media = aEvent.Media;
     _engine = _event.Engine;
     _createCommands();
 }
        public MediaSearchViewmodel(EngineViewmodel engineVM, TMediaType mediaType, bool closeAfterAdd, TVideoFormat? videoFormat)
        {
            _manager = engineVM.Engine.MediaManager;
            _previewViewmodel = engineVM.PreviewViewmodel;
            if (_previewViewmodel != null)
                _previewViewmodel.PropertyChanged += OnPreviewPropertyChanged;
            _mediaType = mediaType;
            if (mediaType == TMediaType.AnimationFlash)
                _searchDirectory = _manager.AnimationDirectoryPGM;
            else
                _searchDirectory = _manager.MediaDirectoryPGM;
            _searchDirectory.MediaAdded += new EventHandler<MediaEventArgs>(_searchDirectory_MediaAdded);
            _searchDirectory.MediaRemoved += new EventHandler<MediaEventArgs>(_searchDirectory_MediaRemoved);
            _searchDirectory.MediaVerified += new EventHandler<MediaEventArgs>(_searchDirectory_MediaVerified);

            _videoFormat = videoFormat;
            _closeAfterAdd = closeAfterAdd;
            _mediaCategory = MediaCategories.FirstOrDefault();
            NewEventStartType = TStartType.After;
            if (!closeAfterAdd)
                OkButtonText = Properties.Resources._button_Add;
            _createCommands();
            _items = new ObservableCollection<MediaViewViewmodel>(_searchDirectory.Files
                .Where(m=> m.MediaType == mediaType && (videoFormat == null || m.VideoFormat == videoFormat))
                .Select(m => new MediaViewViewmodel(m)));
            _itemsView = CollectionViewSource.GetDefaultView(_items);
            _itemsView.SortDescriptions.Add(new SortDescription("MediaName", ListSortDirection.Ascending));
            _itemsView.Filter += _itemsFilter;

            _window = new MediaSearchView();
            _window.Owner = App.Current.MainWindow;
            _window.DataContext = this;
            _window.Closed += _windowClosed;
            _window.Show();
            //_window.Topmost = true;
        }