Beispiel #1
0
        ///<summary>Execute Open project Command</summary>
        void DoOpenProjectCmd(object prm = null)
        {
            FileAccessRequest far = new FileAccessRequest();

            far.IsForReading         = true;
            far.IsMultiSelect        = false;
            far.ExtensionFilter      = "Media Rat project (*.xmr)|*.xmr|Media Rat project (*.xmv)|*.xmv|XML Documents (*.xml)|*.xml|All files (*.*)|*.*";
            far.ExtensionFilterIndex = 1;
            InformationRequest irq = new InformationRequest()
            {
                ResultType = typeof(System.IO.File),
                Prompt     = "Select Media Rat project file",
                Tag        = far
            };
            string sourceFileName = null;

            irq.CompleteMethod = (rq) => {
                if (rq.Result != null)
                {
                    sourceFileName = rq.Result.ToString();
                }
            };
            UIBus uiBus = AppContext.Current.GetServiceViaLocator <UIBus>();

            uiBus.Send(new UIMessage(this, UIBusMessageTypes.InformationRequest, irq));
            OpenFile(sourceFileName);
        }
Beispiel #2
0
        ///<summary>Execute Add Source Command</summary>
        void DoAddSrcCmd(object prm = null)
        {
            this.Status.Clear();
            FileAccessRequest far = new FileAccessRequest();

            far.IsForReading         = true;
            far.IsMultiSelect        = false;
            far.ExtensionFilter      = "Video files (*.mts;*.mp4;*.mov;*.avi)|*.mts;*.mp4;*.mov;*.avi|Audio Files (*.mp3;*.m4a)|*.mp3;*.m4a|All files (*.*)|*.*";
            far.ExtensionFilterIndex = 1;
            InformationRequest irq = new InformationRequest()
            {
                ResultType = typeof(System.IO.File),
                Prompt     = "Select source media file",
                Tag        = far
            };
            string sourceFileName = null;

            irq.CompleteMethod = (rq) => {
                if (rq.Result != null)
                {
                    sourceFileName = rq.Result.ToString();
                }
            };
            UIBus uiBus = AppContext.Current.GetServiceViaLocator <UIBus>();

            uiBus.Send(new UIMessage(this, UIBusMessageTypes.InformationRequest, irq));
            AddMediaSource(sourceFileName);
        }
 ///<summary>Execute Export media sheet Command</summary>
 void DoExportMediaSheetCmd(object prm = null)
 {
     try {
         FileAccessRequest far = new FileAccessRequest();
         far.IsForReading         = false;
         far.IsMultiSelect        = false;
         far.ExtensionFilter      = "XML Documents (*.xml)|*.xml|All files (*.*)|*.*";
         far.ExtensionFilterIndex = 1;
         far.SuggestedFileName    = "MyProject.xml";
         InformationRequest irq = new InformationRequest()
         {
             ResultType = typeof(System.IO.File),
             Prompt     = "Save as XML Media List file",
             Tag        = far
         };
         string           fileName = null;
         List <MediaFile> src      = new List <MediaFile>(this.GetSelectedMedia()); // Get the work set
         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)
         {
             XElement xrt = new XElement("mediaList",
                                         new XAttribute(XNames.xaName, this.Project.Title),
                                         new XAttribute("timestamp", DateTime.Now));
             XDocument xdc = new XDocument(new XDeclaration("1.0", Encoding.UTF8.EncodingName, null), xrt);
             XElement  xr;
             foreach (var mf in src)
             {
                 if (null != (xr = mf.GetMediaListEntry()))
                 {
                     xrt.Add(xr);
                 }
             }
             xdc.Save(fileName);
             this.Status.SetPositive(string.Format("Media List file {0} has been created.", fileName));
         }
     }
     catch (BizException bx) {
         this.Status.SetError(bx.Message);
     }
     catch (Exception x) {
         this.Status.SetError(x.ToShortMsg("Save Media List"));
     }
 }
 ///<summary>Execute Export to Movie Maker Project Command</summary>
 void DoMovMakerProjectCmd(object prm = null)
 {
     try {
         FileAccessRequest far = new FileAccessRequest();
         far.IsForReading         = false;
         far.IsMultiSelect        = false;
         far.ExtensionFilter      = "Movie Maker project (*.wlmp)|*.wlmp|XML Documents (*.xml)|*.xml|All files (*.*)|*.*";
         far.ExtensionFilterIndex = 1;
         far.SuggestedFileName    = "MyProject.wlmp";
         InformationRequest irq = new InformationRequest()
         {
             ResultType = typeof(System.IO.File),
             Prompt     = "Save as Movie Maker 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)
         {
             MovieMakerHelper.MovieOptions options = new MovieMakerHelper.MovieOptions()
             {
                 ImgDisplayTime = 7,
                 TargetFileName = fileName,
                 Name           = this.Project.Title,
                 MediaFiles     = new List <MediaFile>(this.GetSelectedMedia())
             };
             MovieMakerHelper mmHelper = new MovieMakerHelper(options);
             mmHelper.CreateMMakerProject().Save(fileName);
             this.Status.SetPositive(string.Format("MovieMaker project file {0} has been created.", fileName));
         }
     }
     catch (BizException bx) {
         this.Status.SetError(bx.Message);
     }
     catch (Exception x) {
         this.Status.SetError(string.Format("Faield to save Movie Maker project. {0}: {1}", x.GetType().Name, x.Message), x);
     }
 }
Beispiel #5
0
        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);
            }
        }
Beispiel #6
0
        static void InitLocator(ServiceLocator locator)
        {
            //LogVModel log = new LogVModel();
            //WinLog log = new WinLog(AppContext.Current.ApplicationTitle);
            LogVModel log = new LogVModel();

            locator.RegisterInstance <Ops.NetCoe.LightFrame.ILog>(log);
            locator.RegisterInstance <LogVModel>(log);
            AppContext.Current.LogTrace("Init locator");
            locator.RegisterType <IWebProxy>(() => {
                IWebProxy proxy = WebRequest.GetSystemWebProxy();
                return(proxy);
            });

            locator.RegisterSingleton <Ops.NetCoe.LightFrame.IServiceLocator>(() => locator);
            locator.RegisterInstance <VideoHelper>(new VideoHelper());
            ViewFactory vFactory = new ViewFactory();

            vFactory.Register <ImageProjectVModel, ImageProjectView>();
            vFactory.Register <VideoProjectVModel, VideoProjectView>();
            vFactory.Register <PropElementListVModel, PropElementListView>();
            vFactory.Register <TrackGroupVModel, TrackGroupView>();
            vFactory.Register <MediaSplitVModel, MediaSplitView>();
            vFactory.Register <TextRqtVModel, TextRqtView>();
            //vFactory.Register<MonitorVModels.TaskVModel, MonitorViews.TaskView>();

            //locator.RegisterType<NodeSearchVModel>();
            //locator.RegisterType<NodeVModel>();
            //locator.RegisterType<AssetSearchVModel>();
            //locator.RegisterType<AssetVModel>();
            //locator.RegisterType<TextEditVModel>();
            //locator.RegisterType<MonitorVModels.TaskSearchVModel>();

            //locator.RegisterInstance<LogVModel>(log);
            locator.RegisterInstance <ViewFactory>(vFactory);
            var uiBus = new UIBus();

            locator.RegisterInstance <UIBus>(uiBus);
            IUIHelper uhlp = App.Current as IUIHelper;

            if (uhlp == null)
            {
                string em = "Initialization failure: Class App does not implement IUIHelper interface";
                AppContext.Current.LogTechError(em, null);
                throw new TechnicalException(em);
            }
            locator.RegisterInstance <IUIHelper>(uhlp);
            //locator.RegisterInstance<ICrypto>(new Crypto());
            //locator.RegisterType<IisWebsiteVModel, IisWebsiteVModel>();
            //locator.RegisterType<DeploymentTaskVModel, DeploymentTaskVModel>();

            //ServiceEndpointPrefix = AppContext.Current.GetAppCfgItem("ServicePrefix");
            //if (ServiceEndpointPrefix == null) {
            //    ServiceEndpointPrefix = "Default";
            //    AppContext.Current.LogWarning("Configuration error: value appSettings\\@ServicePrefix is not specified. Will fall back to 'Default'.");
            //}


            // Create Main VModel at the end so it can use previos declarations
            MainVModel mvm = new MainVModel();

            locator.RegisterInstance <MainVModel>(mvm);
        }