/// <summary> /// Initializes a new instance of the <see cref="MediaTrackGroup" /> class. /// </summary> /// <param name="project">The project.</param> /// <param name="mediaType">Type of the media.</param> /// <param name="id">The identifier.</param> public MediaTrackGroup(VideoProject project, MediaTypes mediaType, int id) { this.Id = id; this.MediaType = mediaType; this.Project = project; this.Tracks = new ObservableCollection <IMediaTrack>(); this.PropertyChanged += (s, a) => this.Project.IsDirty = true; this.Tracks.CollectionChanged += Tracks_CollectionChanged; }
/// <summary> /// Initializes a new instance of the <see cref="MediaTrack"/> class. /// </summary> /// <param name="project">The project.</param> /// <param name="id">The identifier.</param> /// <param name="source">The source.</param> public MediaTrack(VideoProject project, int id, IContentSource source) { this.Project = project; this.Id = id; this._contentSource = source; if (source != null) { this.ContentSourceId = source.Id; } this.UseTime.PropertyChanged += (s, a) => CalcDuration(); this.CalcDuration(); }
/// <summary> /// Loads the VideoProject from the specified source path. /// </summary> /// <param name="sourcePath">The source path.</param> /// <param name="password">The password.</param> /// <returns></returns> /// <exception cref="Ops.NetCoe.LightFrame.BizException"></exception> public static VideoProject Load(string sourcePath, string password = null) { try{ XDocument xd = XDocument.Load(sourcePath); VideoProject rz = new VideoProject(); rz.ApplyConfiguration(xd.Root, password); rz.ProjectFileName = sourcePath; rz.IsDirty = false; return(rz); } catch (Exception x) { throw new BizException(string.Format("Failed to load Video Project from {0}. {1}: {2}", sourcePath, x.GetType().Name, x.Message)); } }
void SaveProject(VideoProject prj, bool askAltName = false) { if (!string.IsNullOrEmpty(prj.ProjectFileName) && !askAltName) { prj.Save(prj.ProjectFileName); return; } FileAccessRequest far = new FileAccessRequest(); far.IsForReading = false; far.IsMultiSelect = false; far.ExtensionFilter = "Media Rat Video Project (*.xmv)|*.xmv|XML Documents (*.xml)|*.xml|All files (*.*)|*.*"; far.ExtensionFilterIndex = 1; far.SuggestedFileName = "MyProject.xmv"; InformationRequest irq = new InformationRequest() { ResultType = typeof(System.IO.File), Prompt = "Save project file", Tag = far }; string fileName = null; irq.CompleteMethod = (rq) => { if (rq.Result != null) { fileName = rq.Result.ToString(); } }; UIBus uiBus = AppContext.Current.GetServiceViaLocator <UIBus>(); uiBus.Send(new UIMessage(this, UIBusMessageTypes.InformationRequest, irq)); if (fileName != null) { prj.Save(fileName); } }
/// <summary> /// Initializes a new instance of the <see cref="MediaTrack"/> class. /// </summary> /// <param name="project">The project.</param> /// <param name="id">The identifier.</param> public MediaTrack(VideoProject project, int id) { this.Project = project; this.Id = id; this.UseTime.PropertyChanged += (s, a) => CalcDuration(); }
/// <summary> /// Initializes a new instance of the <see cref="MediaSource"/> class. /// </summary> /// <param name="project">The project.</param> /// <param name="id">The identifier.</param> public MediaSource(VideoProject project, int id) { this.Id = id; this.Project = project; this.PropertyChanged += (s, a) => this.Project.IsDirty = true; }
public void LoadProject(string sourcePath) { this.ExecuteAndReport(() => this.Entity = VideoProject.Load(sourcePath)); }