コード例 #1
0
        public override XdsResponseDocument ExecuteXmlDataManager(XdsRequestDocument requestDocument)
        {
            using (var xdsService = new XmlDataService()) {
                var adapter = XmlDataTool.ResolveXmlDataManagerAdapter(ProductName);

                var tcs = new TaskCompletionSource <byte[]>(null);

                ExecuteCompletedEventHandler handler = null;
                handler =
                    (s, e) => EventAsyncPattern.HandleCompletion(tcs, e, () => e.Result, () => xdsService.ExecuteCompleted -= handler);
                xdsService.ExecuteCompleted += handler;

                try {
                    var requestBytes = adapter.RequestSerializer.Serialize(requestDocument);
                    xdsService.ExecuteAsync(requestBytes, ProductName, false, tcs);
                }
                catch (Exception ex) {
                    xdsService.ExecuteCompleted -= handler;
                    tcs.TrySetException(ex);
                }


                tcs.Task.Wait();
                Assert.IsTrue(tcs.Task.IsCompleted);

                return(adapter.ResponseSerializer.Deserialize(tcs.Task.Result));
            }
        }
コード例 #2
0
 static void Main(string[] args)
 {
     //IDataService dataService = new CsvDataService();
     IDataService dataService  = new XmlDataService(DataSettings.dataFilePath);
     CharacterBLL characterBLL = new CharacterBLL(dataService);
     Presenter    presenter    = new Presenter(characterBLL);
 }
コード例 #3
0
 public StatsViewModel(IDialogService dialogService)
 {
     _dialogService = dialogService;
     _service       = new XmlDataService();
     _reader        = new XmlDataReader();
     ReadStats();
 }
コード例 #4
0
 void ExecuteLoadStyleSmall(string parameter)
 {
     if (!string.IsNullOrEmpty(parameter))
     {
         IDataService dataService = new XmlDataService();
         StyleSmallList = dataService.StyleSmallList(parameter);   // 商品类别(小)
     }
 }
コード例 #5
0
        public WorkspaceViewModel(Workspace model)
        {
            DataService = new XmlDataService();
            //DataService = new JsonDataService();

            MongoDB = new MongoDBModule(DataService);
            MongoDB.Setup();
        }
コード例 #6
0
        public void SaveUserInfo(object parameter)
        {
            WriteLog("进行了保存操作");
            XmlDataService ds = new XmlDataService();

            ds.SetAllUsers(mylist);
            MessageBox.Show("保存成功");
        }
コード例 #7
0
        public AddGoodWindowViewModel()
        {
            IDataService dataService = new XmlDataService();

            isHighToxicityList = dataService.IsHighToxicityList();  // 是否高毒
            styleBigList       = dataService.StyleBigList();        // 商品类别(大)
            smallUnitList      = dataService.SmallUnitList();       // 单位(小)
            bigUnitList        = dataService.BigUnitList();         // 单位(大)
        }
コード例 #8
0
        public override XdsResponseDocument ExecuteXmlDataManager(XdsRequestDocument requestDocument)
        {
            using (var xmlDataService = new XmlDataService()) {
                var adapter       = XmlDataTool.ResolveXmlDataManagerAdapter(ProductName);
                var requestBytes  = adapter.RequestSerializer.Serialize(requestDocument);
                var responseBytes = xmlDataService.Execute(requestBytes, ProductName, false);

                return(adapter.ResponseSerializer.Deserialize(responseBytes));
            }
        }
コード例 #9
0
        public void SetUp()
        {
            XmlSerializer ser = new XmlSerializer(typeof(Company));
            Company       result;

            using (TextReader reader = new StringReader(xmlString))
            {
                result = (Company)ser.Deserialize(reader);
            }
            Service = new XmlDataService(result);
        }
コード例 #10
0
 private void LoadDishMenu()
 {
     IDataService ds = new XmlDataService();
     var dishes = ds.GetAllDishes();
     this.DishMenu = new List<DishMenuItemViewModel>();
     foreach (var dish in dishes)
     {
         DishMenuItemViewModel item = new DishMenuItemViewModel();
         item.Dish = dish;
         this.DishMenu.Add(item);
     }
 }
コード例 #11
0
        public void LoadDishMenu()
        {
            XmlDataService ds     = new XmlDataService();
            var            dishes = ds.GetDishList();

            this.DishMenu = new List <DishMenuItemViewModel>();
            foreach (var item in dishes)
            {
                DishMenuItemViewModel menu = new DishMenuItemViewModel();
                menu.Dish = item;
                this.DishMenu.Add(menu);
            }
        }
コード例 #12
0
        private void LoadDishMenu()
        {
            XmlDataService xmlds  = new XmlDataService();
            var            dishes = xmlds.GetAllDishes();

            this.DishMenu = new List <DishMenuItemViewModel>();
            foreach (var dish in dishes)
            {
                DishMenuItemViewModel dmivm = new DishMenuItemViewModel();
                dmivm.Dish = dish;
                this.dishMenu.Add(dmivm);
            }
        }
コード例 #13
0
        private void LoadTicketItem()
        {
            XmlDataService xds    = new XmlDataService();
            var            trains = xds.GetAllTrains();

            this.TicketItem = new List <TicketItemViewModel>();
            foreach (var train in trains)
            {
                TicketItemViewModel tivm = new TicketItemViewModel();
                tivm.Train = train;
                this.ticketItem.Add(tivm);
            }
        }
コード例 #14
0
        public void LoadUserInfo()
        {
            XmlDataService ds    = new XmlDataService();
            var            users = ds.GetAllUsers();

            foreach (var user in users)
            {
                mylist.Add(new User()
                {
                    ID = user.ID, Name = user.Name, Age = user.Age, Sex = user.Sex, Remarks = user.Remarks
                });
            }
        }
コード例 #15
0
        private void LoadDishMenu()
        {
            IDataService ds     = new XmlDataService();
            var          dishes = ds.GetAllDishes();

            this.DishMenu = new List <DishMenuItemViewModel>();
            foreach (var dish in dishes)
            {
                DishMenuItemViewModel item = new DishMenuItemViewModel();
                item.Dish = dish;
                this.DishMenu.Add(item);
            }
        }
コード例 #16
0
        private void LoadDishMenu()
        {
            XmlDataService ds     = new XmlDataService();
            var            dishes = ds.GetAllDishes();

            this.DishMenu = new List <DishMenuItemViewModel>();
            foreach (var item in dishes)
            {
                this.DishMenu.Add(new DishMenuItemViewModel()
                {
                    Dish = item
                });
            }
        }
コード例 #17
0
        /// <summary>
        /// 비동기적으로 Web Service를 호출합니다. 비동기 호출을 동시다발적으로 호출 시 UserState로 각각의 호출을 구분할 수 있어야 한다.
        /// </summary>
        /// <param name="xdsRequest"></param>
        /// <param name="productName"></param>
        /// <param name="compress"></param>
        /// <param name="security"></param>
        private static void VerifyXmlDataServiceAsync(XdsRequestDocument xdsRequest, string productName, bool?compress, bool?security)
        {
            var serializer   = GetSerializer(compress, security);
            var requestBytes = serializer.Serialize(xdsRequest.ConvertToBytes());
            var xdsService   = new XmlDataService();

            var tcs = new TaskCompletionSource <byte[]>(null);

            if (security.GetValueOrDefault(false))
            {
                ExecuteSecurityCompletedEventHandler handler = null;
                handler =
                    (s, e) =>
                    EventAsyncPattern.HandleCompletion(tcs, e, () => e.Result, () => xdsService.ExecuteSecurityCompleted -= handler);
                xdsService.ExecuteSecurityCompleted += handler;

                try {
                    xdsService.ExecuteSecurityAsync(requestBytes, productName, compress.GetValueOrDefault(false), tcs);
                }
                catch (Exception ex) {
                    xdsService.ExecuteSecurityCompleted -= handler;
                    tcs.TrySetException(ex);
                }
            }
            else
            {
                ExecuteCompletedEventHandler handler = null;
                handler =
                    (s, e) => EventAsyncPattern.HandleCompletion(tcs, e, () => e.Result, () => xdsService.ExecuteCompleted -= handler);
                xdsService.ExecuteCompleted += handler;

                try {
                    xdsService.ExecuteAsync(requestBytes, productName, compress.GetValueOrDefault(false), tcs);
                }
                catch (Exception ex) {
                    xdsService.ExecuteCompleted -= handler;
                    tcs.TrySetException(ex);
                }
            }

            tcs.Task.Wait();
            Assert.IsTrue(tcs.Task.IsCompleted);
            var xdsResponse = ((byte[])serializer.Deserialize(tcs.Task.Result)).ConvertToXdsResponseDocument();

            Assert.IsNotNull(xdsResponse);
            Assert.IsFalse(xdsResponse.HasError);
            Assert.IsTrue(xdsResponse.Responses.Count > 0);

            xdsService.Dispose();
        }
コード例 #18
0
        private void LoadDishMenu()
        {
            IDataService xmlDataService = new XmlDataService();
            var          dishList       = xmlDataService.GetAllDishes();

            DishMenu = new ObservableCollection <DishMenuItemViewModel>();
            foreach (var item in dishList)
            {
                DishMenuItemViewModel itemViewModel = new DishMenuItemViewModel()
                {
                    Dish = item,
                };
                DishMenu.Add(itemViewModel);
            }
        }
コード例 #19
0
ファイル: MainWindowViewModel.cs プロジェクト: thr828/WPFDemo
        private void LoadDishMenu()
        {
            XmlDataService xmlData = new XmlDataService();
            var            dishes  = xmlData.GetAllDishes();

            this.DishMenu = new List <DishMenuItemViewModel>();
            foreach (var dish in dishes)
            {
                DishMenuItemViewModel dishMenuModel = new DishMenuItemViewModel()
                {
                    dish = dish
                };
                DishMenu.Add(dishMenuModel);
            }
        }
コード例 #20
0
        //加载菜单列表
        private void LoadMenu()
        {
            XmlDataService xmlDataService = new XmlDataService();
            //获取Xml中Dish列表
            List <Dish> dishes = xmlDataService.GetDishes();

            this.DishMenu = new List <DishViewModel>();
            foreach (var item in dishes)
            {
                DishViewModel dish = new DishViewModel();
                //添加Dish属性
                dish.Dish = item;
                this.DishMenu.Add(dish);
            }
        }
コード例 #21
0
        static void Main(string[] args)
        {
            var options = new ConfigurationOptions
            {
                CountryCodes = new List <string> {
                    "GB"
                },
                XmlDocumentPath = @"\\ServerName\GeoNamesData\LocationXml"
            };

            var xmlDataService = new XmlDataService();
            var documents      = xmlDataService.Get <LocationFormattedName>(options);

            Console.WriteLine("**** Procesing completed successfully. ****");
            Environment.Exit(0);
        }
コード例 #22
0
        private static void MainOperate(string fileName)
        {
            IDataService xmlService = new XmlDataService();
            XMLOptions   xml        = new XMLOptions();

            // 取得檔案
            var fullfielpath = Path.Combine(watcher.XmlFilePath, fileName);
            var files        = xmlService.GetRecords(fullfielpath);

            Console.WriteLine($"開始傳輸檔案,清單:{fileName}");

            client.Operate(files);

            //傳輸完成後產生紀錄檔
            xml.CreateXmlFile(files, $"{cfg.FinishXMLFilePath}{DateTime.Now.ToString("yyyyMMddHHmm")}.xml");
        }
コード例 #23
0
        private void LoadDishMenu()
        {
            // 取到所有菜品
            XmlDataService xds    = new XmlDataService();
            List <Dish>    dishes = xds.GetAllDishes();

            // 转换到新的集合类
            this.DishMenuVM = new List <DishMenuItemViewModel>();
            foreach (var item in dishes)
            {
                DishMenuItemViewModel dmivm = new DishMenuItemViewModel
                {
                    Dish = item,
                };
                this.DishMenuVM.Add(dmivm);
            }
        }
コード例 #24
0
        static void Main(string[] args)
        {
            IDataService DataService;
            CharacterBLL CharacterBLL;
            Presenter    presenter;

            DataService  = new CsvDataService(@"Data/Data.csv");
            CharacterBLL = new CharacterBLL(DataService);
            presenter    = new Presenter(CharacterBLL);

            DataService  = new XmlDataService(@"Data/Data.xml");
            CharacterBLL = new CharacterBLL(DataService);
            presenter    = new Presenter(CharacterBLL);

            DataService  = new JsonDataService();
            CharacterBLL = new CharacterBLL(DataService);
            presenter    = new Presenter(CharacterBLL);
        }
コード例 #25
0
 public ContentRepository(EaDbContext dbContext,
                          ContentFileRepository contentFileRepository,
                          CommentRepository commentRepository,
                          XmlDataService xmlDataService,
                          IOptions <WebApiSettings> settings,
                          SignInManager <EaUser> signInManager,
                          GroupRepository groupRepository,
                          LikeRepository likeRepository,
                          UserManager <EaUser> userManager)
     : base(dbContext, dbContext.Contents)
 {
     _xmlDataService        = xmlDataService;
     _settings              = settings;
     _signInManager         = signInManager;
     _groupRepository       = groupRepository;
     _commentRepository     = commentRepository;
     _likeRepository        = likeRepository;
     _userManager           = userManager;
     _contentFileRepository = contentFileRepository;
 }
コード例 #26
0
        /// ****************************************************
        ///                        导航
        /// ****************************************************

        #region 导航
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            UpdatePurchaseOrders.Execute();

            using (var db = new InventoryDB())
            {
                var query = from o in db.Suppliers
                            select o;
                // 供应商
                SuppliersLookUp = query;

                var goodquery = from o in db.Goods
                                select o;
                // 商品
                GoodsLookUp = goodquery;
            }
            // 制单人
            IDataService dataService = new XmlDataService();

            制单人s = dataService.ZhiDanRen();
        }
コード例 #27
0
ファイル: Program.cs プロジェクト: hansenconnor/Demo_FileIO
        static void Main(string[] args)
        {
            IDataService dataService;
            CharacterBLL characterBLL;
            Presenter    presenter;

            // Run CSV Serializer
            dataService  = new CsvDataService();
            characterBLL = new CharacterBLL(dataService);
            presenter    = new Presenter(characterBLL);

            // Run XML Serializer
            dataService  = new XmlDataService();
            characterBLL = new CharacterBLL(dataService);
            presenter    = new Presenter(characterBLL);

            // Run JSON Serializer
            dataService  = new JsonDataService();
            characterBLL = new CharacterBLL(dataService);
            presenter    = new Presenter(characterBLL);
        }
コード例 #28
0
ファイル: App.cs プロジェクト: dkwingsmt/HeroesDataParser
        private void SetUpDataProcessors()
        {
            IXmlDataService xmlDataService = new XmlDataService(Configuration, GameData, DefaultData);

            DataHero              dataHero              = new DataHero(new HeroDataParser(xmlDataService.GetInstance(), (HeroOverrideLoader)XmlDataOverriders.GetOverrider(typeof(HeroDataParser))));
            DataUnit              dataUnit              = new DataUnit(new UnitParser(xmlDataService.GetInstance(), (UnitOverrideLoader)XmlDataOverriders.GetOverrider(typeof(UnitParser))));
            DataMatchAward        dataMatchAward        = new DataMatchAward(new MatchAwardParser(xmlDataService.GetInstance(), (MatchAwardOverrideLoader)XmlDataOverriders.GetOverrider(typeof(MatchAwardParser))));
            DataHeroSkin          dataHeroSkin          = new DataHeroSkin(new HeroSkinParser(xmlDataService.GetInstance()));
            DataMount             dataMount             = new DataMount(new MountParser(xmlDataService.GetInstance()));
            DataBanner            dataBanner            = new DataBanner(new BannerParser(xmlDataService.GetInstance()));
            DataSpray             dataSpray             = new DataSpray(new SprayParser(xmlDataService.GetInstance()));
            DataAnnouncer         dataAnnouncer         = new DataAnnouncer(new AnnouncerParser(xmlDataService.GetInstance()));
            DataVoiceLine         dataVoiceLine         = new DataVoiceLine(new VoiceLineParser(xmlDataService.GetInstance()));
            DataPortrait          dataPortrait          = new DataPortrait(new PortraitParser(xmlDataService.GetInstance()));
            DataEmoticon          dataEmoticon          = new DataEmoticon(new EmoticonParser(xmlDataService.GetInstance()));
            DataEmoticonPack      dataEmoticonPack      = new DataEmoticonPack(new EmoticonPackParser(xmlDataService.GetInstance()));
            DataBehaviorVeterancy dataBehaviorVeterancy = new DataBehaviorVeterancy(new BehaviorVeterancyParser(xmlDataService.GetInstance()));

            ImageHero       filesHero       = new ImageHero(CASCHotsStorage?.CASCHandler, StoragePath);
            ImageUnit       filesUnit       = new ImageUnit(CASCHotsStorage?.CASCHandler, StoragePath);
            ImageMatchAward filesMatchAward = new ImageMatchAward(CASCHotsStorage?.CASCHandler, StoragePath);
            ImageAnnouncer  filesAnnouncer  = new ImageAnnouncer(CASCHotsStorage?.CASCHandler, StoragePath);
            ImageVoiceLine  filesVoiceLine  = new ImageVoiceLine(CASCHotsStorage?.CASCHandler, StoragePath);
            ImageSpray      filesSpray      = new ImageSpray(CASCHotsStorage?.CASCHandler, StoragePath);
            ImageEmoticon   filesEmoticon   = new ImageEmoticon(CASCHotsStorage?.CASCHandler, StoragePath);

            DataProcessors.Add(new DataProcessor()
            {
                IsEnabled = ExtractDataOption.HasFlag(ExtractDataOption.HeroData),
                Name      = dataHero.Name,
                Parse     = (localization) => dataHero.Parse(localization),
                Validate  = (localization) => dataHero.Validate(localization),
                Extract   = (data) => filesHero.ExtractFiles(data),
            });

            DataProcessors.Add(new DataProcessor()
            {
                IsEnabled = ExtractDataOption.HasFlag(ExtractDataOption.Unit),
                Name      = dataUnit.Name,
                Parse     = (localization) => dataUnit.Parse(localization),
                Validate  = (localization) => dataUnit.Validate(localization),
                Extract   = (data) => filesUnit.ExtractFiles(data),
            });

            DataProcessors.Add(new DataProcessor()
            {
                IsEnabled = ExtractDataOption.HasFlag(ExtractDataOption.MatchAward),
                Name      = dataMatchAward.Name,
                Parse     = (localization) => dataMatchAward.Parse(localization),
                Validate  = (localization) => dataMatchAward.Validate(localization),
                Extract   = (data) => filesMatchAward.ExtractFiles(data),
            });

            DataProcessors.Add(new DataProcessor()
            {
                IsEnabled = ExtractDataOption.HasFlag(ExtractDataOption.HeroSkin),
                Name      = dataHeroSkin.Name,
                Parse     = (localization) => dataHeroSkin.Parse(localization),
                Validate  = (localization) => dataHeroSkin.Validate(localization),
            });

            DataProcessors.Add(new DataProcessor()
            {
                IsEnabled = ExtractDataOption.HasFlag(ExtractDataOption.Mount),
                Name      = dataMount.Name,
                Parse     = (localization) => dataMount.Parse(localization),
                Validate  = (localization) => dataMount.Validate(localization),
            });

            DataProcessors.Add(new DataProcessor()
            {
                IsEnabled = ExtractDataOption.HasFlag(ExtractDataOption.Banner),
                Name      = dataBanner.Name,
                Parse     = (localization) => dataBanner.Parse(localization),
                Validate  = (localization) => dataBanner.Validate(localization),
            });

            DataProcessors.Add(new DataProcessor()
            {
                IsEnabled = ExtractDataOption.HasFlag(ExtractDataOption.Spray),
                Name      = dataSpray.Name,
                Parse     = (localization) => dataSpray.Parse(localization),
                Validate  = (localization) => dataSpray.Validate(localization),
                Extract   = (data) => filesSpray.ExtractFiles(data),
            });

            DataProcessors.Add(new DataProcessor()
            {
                IsEnabled = ExtractDataOption.HasFlag(ExtractDataOption.Announcer),
                Name      = dataAnnouncer.Name,
                Parse     = (localization) => dataAnnouncer.Parse(localization),
                Validate  = (localization) => dataAnnouncer.Validate(localization),
                Extract   = (data) => filesAnnouncer.ExtractFiles(data),
            });

            DataProcessors.Add(new DataProcessor()
            {
                IsEnabled = ExtractDataOption.HasFlag(ExtractDataOption.VoiceLine),
                Name      = dataVoiceLine.Name,
                Parse     = (localization) => dataVoiceLine.Parse(localization),
                Validate  = (localization) => dataVoiceLine.Validate(localization),
                Extract   = (data) => filesVoiceLine.ExtractFiles(data),
            });

            DataProcessors.Add(new DataProcessor()
            {
                IsEnabled = ExtractDataOption.HasFlag(ExtractDataOption.Portrait),
                Name      = dataPortrait.Name,
                Parse     = (localization) => dataPortrait.Parse(localization),
                Validate  = (localization) => dataPortrait.Validate(localization),
            });

            DataProcessors.Add(new DataProcessor()
            {
                IsEnabled = ExtractDataOption.HasFlag(ExtractDataOption.Emoticon),
                Name      = dataEmoticon.Name,
                Parse     = (localization) => dataEmoticon.Parse(localization),
                Validate  = (localization) => dataEmoticon.Validate(localization),
                Extract   = (data) => filesEmoticon.ExtractFiles(data),
            });

            DataProcessors.Add(new DataProcessor()
            {
                IsEnabled = ExtractDataOption.HasFlag(ExtractDataOption.EmoticonPack),
                Name      = dataEmoticonPack.Name,
                Parse     = (localization) => dataEmoticonPack.Parse(localization),
                Validate  = (localization) => dataEmoticonPack.Validate(localization),
            });

            DataProcessors.Add(new DataProcessor()
            {
                IsEnabled = ExtractDataOption.HasFlag(ExtractDataOption.Veterancy),
                Name      = dataBehaviorVeterancy.Name,
                Parse     = (localization) => dataBehaviorVeterancy.Parse(localization),
                Validate  = (localization) => dataBehaviorVeterancy.Validate(localization),
            });
        }