Beispiel #1
0
        public virtual void OpenPage(string pageName)
        {
            if (string.IsNullOrWhiteSpace(pageName))
            {
                return;
            }
            var pageModule = viewModel.ModuleManager.Modules.FirstOrDefault(t => t.Name.Equals(pageName));

            if (pageModule == null)
            {
                return;
            }

            var module = viewModel.ModuleList.FirstOrDefault(t => t.Name == pageModule.Name);

            if (module == null)
            {
                IBaseModule dialog = ServiceProvider.Get <IBaseModule>(pageModule.TypeName);
                dialog.BindDefaultModel();
                viewModel.ModuleList.Add(new ModuleUIComponent()
                {
                    Code     = pageModule.Code,
                    Name     = pageModule.Name,
                    TypeName = pageModule.TypeName,
                    Body     = dialog.GetView()
                });
                viewModel.CurrentModule = viewModel.ModuleList.Last();
                GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
                GC.Collect();
            }
            else
            {
                viewModel.CurrentModule = module;
            }
        }
        public ContentResourcePackageManager(IBaseModule module, IConstants constants)
        {
            this.level     = module as Level;
            this.constants = constants;

            this.BuildPackageVersionName();
        }
Beispiel #3
0
        private void Client_ReceiveData(string devName, DevType head, IBaseModule module)
        {
            switch (head)
            {
            case DevType.行车:
                AwcDataRecive?.Invoke(devName, (DeviceAWC)module);
                break;

            case DevType.固定辊台:
                FrtDataRecive?.Invoke(devName, (DeviceFRT)module);
                break;

            case DevType.摆渡车:
                ArfDataRecive?.Invoke(devName, (DeviceARF)module);
                break;

            case DevType.运输车:
                RgvDataRecive?.Invoke(devName, (DeviceRGV)module);
                break;

            case DevType.包装线辊台:
                PklDataRecive?.Invoke(devName, (DevicePKL)module);
                break;

            default:
                break;
            }
        }
        public MediaResourcePackageManager(IBaseModule module, IConstants constants)
        {
            this.lesson = module as Lesson;
            this.constants = constants;

            this.BuildPackageVersionName();
        }
        public MediaResourcePackageManager(IBaseModule module, IConstants constants)
        {
            this.lesson    = module as Lesson;
            this.constants = constants;

            this.BuildPackageVersionName();
        }
Beispiel #6
0
        /// <summary>
        /// 打开页面
        /// </summary>
        /// <param name="pageName"></param>
        /// <returns></returns>
        public async virtual Task OpenPage(string pageName)
        {
            if (string.IsNullOrWhiteSpace(pageName))
            {
                return;
            }
            var pageModule = this.ModuleManager.Modules.FirstOrDefault(t => t.Name.Equals(pageName));

            if (pageModule == null)
            {
                return;
            }

            var module = this.ModuleList.FirstOrDefault(t => t.Name == pageModule.Name);

            if (module == null)
            {
                IBaseModule dialog = NetCoreProvider.Get <IBaseModule>(pageModule.TypeName);
                await dialog.BindDefaultModel(pageModule.Auth);

                this.ModuleList.Add(new ModuleUIComponent()
                {
                    Code     = pageModule.Code,
                    Auth     = pageModule.Auth,
                    Name     = pageModule.Name,
                    TypeName = pageModule.TypeName,
                    Body     = dialog.GetView()
                });
                this.CurrentModule = this.ModuleList.Last();
            }
            else
            {
                this.CurrentModule = module;
            }
        }
        public ContentResourcePackageManager(IBaseModule module, IConstants constants)
        {
            this.level = module as Level;
            this.constants = constants;

            this.BuildPackageVersionName();
        }
 public Node(IBaseModule module, Type view, string title, BitmapImage icon, List <Node> nodes = null)
 {
     Module = module;
     View   = view;
     Title  = title;
     Icon   = icon;
     Nodes  = nodes ?? new List <Node>();
 }
        // Support Lesson media package now.
        public MediaMapfileManager(IBaseModule baseModule, IConstants constants)
        {
            this.baseModule = baseModule;
            this.constants  = constants;

            this.Mapfile = new Mapfile();

            this.filePath = this.constants.LocalMediaPath + string.Format(@"lesson_{0}.json", this.baseModule.Id);
        }
Beispiel #10
0
        // Support Lesson media package now.
        public ContentMapfileManager(IBaseModule baseModule, IConstants constants)
        {
            this.baseModule = baseModule;
            this.constants  = constants;

            this.Mapfile = new Mapfile();

            this.filePath = this.constants.LocalContentPath + string.Format(@"level_{0}_{1}.json", this.baseModule.Id, this.constants.CultureCode);
        }
        // Support Lesson media package now.
        public MediaMapfileManager(IBaseModule baseModule, IConstants constants)
        {
            this.baseModule = baseModule;
            this.constants = constants;

            this.Mapfile = new Mapfile();

            this.filePath = this.constants.LocalMediaPath + string.Format(@"lesson_{0}.json", this.baseModule.Id);
        }
        // Support Lesson media package now.
        public ContentMapfileManager(IBaseModule baseModule, IConstants constants)
        {
            this.baseModule = baseModule;
            this.constants = constants;

            this.Mapfile = new Mapfile();

            this.filePath = this.constants.LocalContentPath + string.Format(@"level_{0}_{1}.json", this.baseModule.Id, this.constants.CultureCode);
        }
Beispiel #13
0
        public Unit(Dictionary <string, List <JToken> > csArray, int unitId, IBaseModule parentModule)
        {
            var jModule =
                from p in csArray["unit"].AsParallel()
                where p["id"].ToString().Equals("unit!" + unitId)
                select p;

            this.jToken = jModule.First();

            this.ParentModule = parentModule;

            //
            BuildModule();

            BuildSubmodule(csArray);
        }
        public Unit(Dictionary<string, List<JToken>> csArray, int unitId, IBaseModule parentModule)
        {
            var jModule =
                 from p in csArray["unit"].AsParallel()
                 where p["id"].ToString().Equals("unit!" + unitId)
                 select p;

            this.jToken = jModule.First();

            this.ParentModule = parentModule;

            //
            BuildModule();

            BuildSubmodule(csArray);
        }
        public Activity(Dictionary<string, List<JToken>> csArray, int activityId, IBaseModule parentModule)
        {
            var jModule =
                 from p in csArray["activity"]
                 where p["id"].ToString().Equals("activity!" + activityId)
                 select p;

            this.jToken = jModule.First();

            this.ParentModule = parentModule;
            this.SubModules = null;

            //
            BuildModule();

            BuildSubmodule(csArray);
        }
        public Activity(Dictionary <string, List <JToken> > csArray, int activityId, IBaseModule parentModule)
        {
            var jModule =
                from p in csArray["activity"]
                where p["id"].ToString().Equals("activity!" + activityId)
                select p;

            this.jToken = jModule.First();

            this.ParentModule = parentModule;
            this.SubModules   = null;

            //
            BuildModule();

            BuildSubmodule(csArray);
        }
        //
        public LevelContentResourceDownloadManager(IDownloadService downloadService, IBaseModule module, IContentResourceServcie resourceService, IConstants constants)
        {
            this.downloadService = downloadService;
            this.levelContentResourceService = resourceService;
            this.constants = constants;

            this.Level = module as Level;

            var filePath = string.Format(@"level_{0}\{1}\Level_{2}.json", this.Level.Id, this.constants.CultureCode, this.Level.Id);
            this.savePath = this.constants.LocalContentPath + filePath;

            this.ResourceList = new List<MapfileItem>();

            MapfileItem f = new MapfileItem();
            f.FileName = filePath;

            this.ResourceList.Add(f);
        }
Beispiel #18
0
        /// <summary>
        /// 通知信息接收
        /// </summary>
        /// <param name="type"></param>
        /// <param name="data"></param>
        internal override void NoticeDataReceive(DevType head, byte[] data)
        {
            ReciveDataHandler tmp = ReceiveData;

            if (tmp != null)
            {
                try
                {
                    IBaseModule message = MessageParser.Parse(head, data);

                    tmp(m_DevName, head, message);
                }
                catch (Exception e)
                {
                    log.LOG(e);
                    //Console.WriteLine(ex.Message + ex.StackTrace);
                }
            }
        }
Beispiel #19
0
        //
        public UnitContentResourceDownloadManager(IDownloadService downloadService, IBaseModule unit, IContentResourceServcie unitContentService, IConstants constants)
        {
            this.downloadService    = downloadService;
            this.constants          = constants;
            this.unitContentService = unitContentService;

            this.Unit = unit as Unit;

            var originalContent = unitContentService.Content;

            // Replace swf to jpg, flv to mp4
            ContentHelper.ReplaceUrlFileFormat(ref originalContent);
            ContentHelper.ReplaceUrlToLocalResourcePath(ref originalContent);

            this.updatedContent = originalContent;

            this.ResourceList = new List <MapfileItem>();
            this.BuildDownloadResource();
        }
        //
        public UnitContentResourceDownloadManager(IDownloadService downloadService, IBaseModule unit, IContentResourceServcie unitContentService, IConstants constants)
        {
            this.downloadService = downloadService;
            this.constants = constants;
            this.unitContentService = unitContentService;

            this.Unit = unit as Unit;

            var originalContent = unitContentService.Content;

            // Replace swf to jpg, flv to mp4
            ContentHelper.ReplaceUrlFileFormat(ref originalContent);
            ContentHelper.ReplaceUrlToLocalResourcePath(ref originalContent);

            this.updatedContent = originalContent;

            this.ResourceList = new List<MapfileItem>();
            this.BuildDownloadResource();
        }
        public MediaResourceDownloadManager(IDownloadService downloadService, IBaseModule module, IContentResourceServcie activityContentResourceService, IConstants constants)
        {
            this.downloadService = downloadService;
            this.baseModule = module;
            this.constants = constants;
            this.activityContentResourceService = activityContentResourceService;

            string oriContent = this.activityContentResourceService.Content;
            mediaList = ContentHelper.GetMediaResources(ref oriContent);

            this.ResourceList = new List<MapfileItem>();

            // Build ResourceList for Mapfile.
            foreach (var m in mediaList)
            {
                MapfileItem f = new MapfileItem();
                f.FileName = m;
                ResourceList.Add(f);
            }
        }
Beispiel #22
0
        //
        public LevelContentResourceDownloadManager(IDownloadService downloadService, IBaseModule module, IContentResourceServcie resourceService, IConstants constants)
        {
            this.downloadService             = downloadService;
            this.levelContentResourceService = resourceService;
            this.constants = constants;

            this.Level = module as Level;

            var filePath = string.Format(@"level_{0}\{1}\Level_{2}.json", this.Level.Id, this.constants.CultureCode, this.Level.Id);

            this.savePath = this.constants.LocalContentPath + filePath;

            this.ResourceList = new List <MapfileItem>();

            MapfileItem f = new MapfileItem();

            f.FileName = filePath;

            this.ResourceList.Add(f);
        }
Beispiel #23
0
        public MediaResourceDownloadManager(IDownloadService downloadService, IBaseModule module, IContentResourceServcie activityContentResourceService, IConstants constants)
        {
            this.downloadService = downloadService;
            this.baseModule      = module;
            this.constants       = constants;
            this.activityContentResourceService = activityContentResourceService;

            string oriContent = this.activityContentResourceService.Content;

            mediaList = ContentHelper.GetMediaResources(ref oriContent);

            this.ResourceList = new List <MapfileItem>();

            // Build ResourceList for Mapfile.
            foreach (var m in mediaList)
            {
                MapfileItem f = new MapfileItem();
                f.FileName = m;
                ResourceList.Add(f);
            }
        }
        //
        public ActivityContentResourceDownloadManager(IDownloadService downloadService, IBaseModule activity, IContentResourceServcie resourceService, IConstants constants)
        {
            this.downloadService = downloadService;
            this.constants = constants;
            this.activityContentResourceService = resourceService;

            ResourceList = new List<MapfileItem>();

            this.Activity = activity as Activity;

            string oriContent = activityContentResourceService.Content;

            // Replace swf to jpg, flv to mp4
            ContentHelper.ReplaceUrlFileFormat(ref oriContent);

            ContentHelper.ReplaceUrlToLocalResourcePath(ref oriContent);

            this.updatedContent = oriContent;

            BuildDownloadResource();
        }
 public ModuleArgs(IBaseModule module)
 {
     Module = module;
 }
        //
        public ActivityContentResourceDownloadManager(IDownloadService downloadService, IBaseModule activity, IContentResourceServcie resourceService, IConstants constants)
        {
            this.downloadService = downloadService;
            this.constants       = constants;
            this.activityContentResourceService = resourceService;

            ResourceList = new List <MapfileItem>();

            this.Activity = activity as Activity;

            string oriContent = activityContentResourceService.Content;

            // Replace swf to jpg, flv to mp4
            ContentHelper.ReplaceUrlFileFormat(ref oriContent);

            ContentHelper.ReplaceUrlToLocalResourcePath(ref oriContent);

            this.updatedContent = oriContent;

            BuildDownloadResource();
        }
Beispiel #27
0
 /// <summary>
 /// 发送数据构造函数
 /// </summary>
 /// <param name="msgtype"></param>
 /// <param name="functype"></param>
 /// <param name="md"></param>
 public IMessageBase(IBaseModule md) : this()
 {
     Module = md;
 }
Beispiel #28
0
 public void AddModule(IBaseModule module)
 {
     modules.Add(module);
 }