예제 #1
0
 public CustomersOrderController(UserManager um, CustomerService cs, CustomerOrderService cos, DictService ds)
 {
     this.um  = um;
     this.cs  = cs;
     this.cos = cos;
     this.ds  = ds;
 }
예제 #2
0
        public static void Match(
            [Required(Description = "Word to match")] string word,
            [Required(Description = "Strategy identifier")] string strategy,
            [Optional("", Description = "Dictionary identifier")] string dict,
            [Optional("", Description = "The url of the proxy server to use for http requests")] string proxy,
            [Optional("", Description = "The user name to use when the connecting to a proxy server that requires authentication")] string proxyusername,
            [Optional("", Description = "The password to use when the connecting to a proxy server that requires authentication")] string proxypassword,
            [Optional("", Description = "The domain to use when the connecting to a proxy server that requires authentication")] string proxydomain
            )
        {
            try
            {
                DictService svc = new DictService();
                SetupProxyServer(svc, proxy, proxyusername, proxypassword, proxydomain);

                DictionaryWord[] words;
                if (String.IsNullOrEmpty(dict))
                {
                    words = svc.Match(word, strategy);
                }
                else
                {
                    words = svc.MatchInDict(dict, word, strategy);
                }

                foreach (DictionaryWord w in words)
                {
                    Console.WriteLine("{0} : {1}", w.DictionaryId, w.Word);
                }
            }
            catch (System.Exception e)
            {
                Console.WriteLine("Error: {0}", e.Message);
            }
        }
예제 #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Log.Info("Dictionary", "Hello World!");

            service = new DictService();

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            toolbar     = FindViewById <SupportToolbar> (Resource.Id.toolbar);
            searchField = FindViewById <EditText> (Resource.Id.SearchField);
            //searchButton = FindViewById<ImageButton> (Resource.Id.SearchButton);
            searchInfo = FindViewById <TextView> (Resource.Id.SearchInfo);
            wordList   = FindViewById <ListView> (Resource.Id.WordList);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = "Dinky Dictionary";

            //searchButton.Enabled = false;

            searchField.AfterTextChanged += (sender, e) => SearchHandler();
            //searchButton.Click += (sender, e) => SearchHandler();

            wordResultList   = new List <WordResult> ();
            adapter          = new MainResultAdapter(this, wordResultList);
            wordList.Adapter = adapter;
        }
예제 #4
0
 public CustomersController(CustomerService cs
                            , DictService ds
                            , ISessionAppService sas)
 {
     this.cs  = cs;
     this.ds  = ds;
     this.sas = sas;
 }
예제 #5
0
        private void OnAddClicked(object sender, EventArgs args)
        {
            var chi = new HashSet <string>();

            foreach (var s in webTGroup.SelectedItems)
            {
                chi.Add(s);
            }
            foreach (var s in finTGroup.SelectedItems)
            {
                chi.Add(s);
            }
            DictService.AddWord(word.Text.ToLower(), chi);
        }
예제 #6
0
        private async void FrmMain_Load(object sender, EventArgs e)
        {
            metroTabControl1.SelectedIndex = 0;
            dictionaryList = new Dictionary <string, string>();
            strategyList   = new Dictionary <string, string>();

            service = new DictService();
            LoadDictToCombo();
            LoadStrategiesToCombo();

            MakeLoadPanelHide(metroPanelHome);
            MakeLoadPanelHide(metroPanelLoad);
            MakeLoadPanelHide(metroPanelMatch);
        }
예제 #7
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif
            PageShell shell = Window.Current.Content as PageShell;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (shell == null)
            {
                //init
                try
                {
                    LogUtil_UWP.Init();
                    SpecificUtils.Init(
                        new FileUtil_UWP(),
                        new ImageUtil_UWP(),
                        new HUDPopup_UWP(),
                        new ThreadUtil_UWP(),
                        new SQLiteUtil_UWP(),
                        new LogUtil_UWP()
                        );
                    DictService.Init();
                    NetService.Choose(0);
                }
                catch (Exception e)
                {
                    e.CopeWith("init app");
                }

                // Create a Frame to act as the navigation context and navigate to the first page
                shell = new PageShell();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }
            }
            // Place our app shell in the current Window
            Window.Current.Content = shell;

            // Ensure the current window is active
            Window.Current.Activate();
        }
예제 #8
0
 public static void ServerInfo(
     [Optional("", Description = "The url of the proxy server to use for http requests")] string proxy,
     [Optional("", Description = "The user name to use when the connecting to a proxy server that requires authentication")] string proxyusername,
     [Optional("", Description = "The password to use when the connecting to a proxy server that requires authentication")] string proxypassword,
     [Optional("", Description = "The domain to use when the connecting to a proxy server that requires authentication")] string proxydomain
     )
 {
     try
     {
         DictService svc = new DictService();
         SetupProxyServer(svc, proxy, proxyusername, proxypassword, proxydomain);
         Console.WriteLine(svc.ServerInfo());
     }
     catch (System.Exception e)
     {
         Console.WriteLine("Error: {0}", e.Message);
     }
 }
예제 #9
0
        private async void OnClickSearch(object sender, EventArgs args)
        {
            if (string.IsNullOrWhiteSpace(word.Text))
            {
                return;
            }
            try
            {
                var trans = await TranslateService.Eng2Chi(word.Text.ToLower());

                webTGroup.Set(trans);
                finTGroup.Set(await DictService.MatchMeanings(trans));
            }
            catch (Exception e)
            {
                e.CopeWith("searching");
            }
        }
예제 #10
0
 public ClientsDataController(
     PermissionService permissionService,
     DictItemService dictItemService,
     DictService dictService,
     OrganizeService organizeService,
     RoleService roleService,
     UserService userService,
     ResourceService resourceService,
     PositionService positionService)
 {
     _permissionService = permissionService;
     _dictItemService   = dictItemService;
     _dictService       = dictService;
     _organizeService   = organizeService;
     _roleService       = roleService;
     _userService       = userService;
     _resourceService   = resourceService;
     _positionService   = positionService;
 }
예제 #11
0
 public DoctorController(IMemoryCache memoryCache
                         , DispensingService dispensingSvr
                         , DrugService drugSrv
                         , Services.JKWebNetService jkSvr
                         , AccessService accSvr
                         , DictService dictSvr
                         , TreatService treatSvr
                         , IMapper mapper
                         , DbContext.CHISEntitiesSqlServer db) : base(db)
 {
     _dispensingSvr = dispensingSvr;
     _drugSrv       = drugSrv;
     _memoryCache   = memoryCache;
     _jkSvr         = jkSvr;
     _accSvr        = accSvr;
     _dictSvr       = dictSvr;
     _treatSvr      = treatSvr;
     _mapper        = mapper;
 }
예제 #12
0
        public static void Define(
            [Required(Description = "Word to define")] string word,
            [Optional("", Description = "Dictionary identifier")] string dict,
            [Optional("", Description = "The url of the proxy server to use for http requests")] string proxy,
            [Optional("", Description = "The user name to use when the connecting to a proxy server that requires authentication")] string proxyusername,
            [Optional("", Description = "The password to use when the connecting to a proxy server that requires authentication")] string proxypassword,
            [Optional("", Description = "The domain to use when the connecting to a proxy server that requires authentication")] string proxydomain
            )
        {
            try
            {
                DictService svc = new DictService();
                SetupProxyServer(svc, proxy, proxyusername, proxypassword, proxydomain);
                WordDefinition wd;
                if (String.IsNullOrEmpty(dict))
                {
                    wd = svc.Define(word);
                }
                else
                {
                    wd = svc.DefineInDict(dict, word);
                }

                if (wd.Definitions.Length == 0)
                {
                    Console.WriteLine("No definitions for {0} found.", word);
                    return;
                }

                foreach (Definition d in wd.Definitions)
                {
                    Console.WriteLine("From {0}:", d.Dictionary.Name);
                    Console.WriteLine(d.WordDefinition);
                    Console.WriteLine();
                }
            }
            catch (System.Exception e)
            {
                Console.WriteLine("Error: {0}", e.Message);
            }
        }
예제 #13
0
파일: App.cs 프로젝트: fenildf/WordsLinks
 public App()
 {
     try
     {
         SpecificUtils.Init(
             DependencyService.Get <FileUtil>(),
             DependencyService.Get <ImageUtil>(),
             DependencyService.Get <HUDPopup>(),
             DependencyService.Get <ThreadUtil>(),
             DependencyService.Get <SQLiteUtil>(),
             DependencyService.Get <LogUtil>()
             );
         DictService.Init();
         NetService.Choose(0);
         MainPage = new MainPage();
     }
     catch (Exception e)
     {
         e.CopeWith("init app");
     }
 }
예제 #14
0
        private void OnAddClicked(object sender, TappedRoutedEventArgs args)
        {
            var chi = new HashSet <string>();

            foreach (var s in webTGroup.SelectedItems)
            {
                chi.Add(s);
            }
            foreach (var s in finTGroup.SelectedItems)
            {
                chi.Add(s);
            }
            try
            {
                DictService.AddWord(word.Text.ToLower(), chi);
            }
            catch (Exception e)
            {
                e.CopeWith("Add Word");
            }
        }
예제 #15
0
 public static void DictionaryList(
     [Optional("", Description = "The url of the proxy server to use for http requests")] string proxy,
     [Optional("", Description = "The user name to use when the connecting to a proxy server that requires authentication")] string proxyusername,
     [Optional("", Description = "The password to use when the connecting to a proxy server that requires authentication")] string proxypassword,
     [Optional("", Description = "The domain to use when the connecting to a proxy server that requires authentication")] string proxydomain
     )
 {
     try
     {
         DictService svc = new DictService();
         SetupProxyServer(svc, proxy, proxyusername, proxypassword, proxydomain);
         Dictionary[] dicts = svc.DictionaryList();
         foreach (Dictionary d in dicts)
         {
             Console.WriteLine("{0} : {1}", d.Id, d.Name);
         }
     }
     catch (System.Exception e)
     {
         Console.WriteLine("Error: {0}", e.Message);
     }
 }
예제 #16
0
 private void RefreshWords()
 {
     if (keyword == null)
     {
         if (dictTime >= DictService.updTimeAll)
         {
             return;
         }
         dictTime = DictService.updTimeAll;
         wgroups.Set(DictService.Words);
     }
     else
     {
         if (dictTime >= DictService.updTimeDetail)
         {
             return;
         }
         dictTime = DictService.updTimeDetail;
         var ms    = DictService.GetMeansByWord(keyword);
         var datas = (ms?.Cast <WordElement>()) ?? DictService.GetWordsByMean(keyword).Cast <WordElement>();
         words.ItemsSource = WordGroupHelper.MakeData(datas.Select(x => x.GetStr()));
         wcnt.Text         = $"生疏程度 :  {DictService.GetWordStat(keyword).wrong}";
     }
 }
예제 #17
0
 public DictController(DictService dictSrv)
 {
     _dictSrv = dictSrv;
 }
예제 #18
0
 public DictItemController(DictService dictService, DictItemService dictItemService)
 {
     _dictService     = dictService;
     _dictItemService = dictItemService;
 }
예제 #19
0
 public DictController(DictService dictService)
 {
     _dictService = dictService;
 }
예제 #20
0
        private async void OnDBTapped(object sender, TappedRoutedEventArgs args)
        {
            if (sender == exportDB)
            {
                try
                {
                    var ret = DictService.Export();
                    hudPopup.Show(msg: "导出中");
                    byte[] data = await ret;
                    //Logger($"before save {data.Length} bytes data");
                    if (await imgUtil.SaveImage(data))
                    {
                        hudPopup.Show(HUDType.Success, "导出成功");
                    }
                    else
                    {
                        hudPopup.Show(HUDType.Fail, "导出失败");
                    }
                }
                catch (Exception e)
                {
                    e.CopeWith("exportDB");
                }
            }
            else if (sender == importDB)
            {
                try
                {
                    var pic = imgUtil.GetImage();
                    if ((await pic) != null)
                    {
                        bool?confirm = await ImportChoose();

                        if (confirm.HasValue)
                        {
                            var ret = DictService.Import(pic.Result, confirm.Value);
                            hudPopup.Show(msg: "导入中");
                            if (await ret)
                            {
                                hudPopup.Show(HUDType.Success, "导入成功");
                            }
                            else
                            {
                                hudPopup.Show(HUDType.Fail, "导入失败");
                            }
                            RefreshWords();
                        }
                    }
                }
                catch (Exception e)
                {
                    e.CopeWith("importDB");
                }
            }
            else if (sender == clearDB)
            {
                if (await clearConfirm())
                {
                    DictService.Clear();
                    RefreshWords();
                }
            }
        }
예제 #21
0
 public DataController(ApiService apiService,
                       DictService dictService)
 {
     _apiService  = apiService;
     _dictService = dictService;
 }
예제 #22
0
 public DictServiceTests()
 {
     _dictService = AutofacExt.GetFromFac <DictService>();
 }
예제 #23
0
 public UsersController(IUserAppService userAppService, DictService ds)
 {
     _userAppService = userAppService;
     this.ds         = ds;
 }
예제 #24
0
        private async void OnDBCellTapped(object sender, EventArgs args)
        {
            if (sender == exportCell)
            {
                try
                {
                    var ret = DictService.Export();
                    hudPopup.Show(msg: "导出中");
                    byte[] data = await ret;
                    if (await imgUtil.SaveImage(data))
                    {
                        hudPopup.Show(HUDType.Success, "导出成功");
                    }
                    else
                    {
                        hudPopup.Show(HUDType.Fail, "导出失败");
                    }
                }
                catch (Exception e)
                {
                    e.CopeWith("exportDB");
                }
            }
            else if (sender == importCell)
            {
                try
                {
                    var pic = imgUtil.GetImage();
                    if ((await pic) != null)
                    {
                        bool?confirm = await ImportChoose();

                        if (confirm.HasValue)
                        {
                            bool isImWCnt = false;
                            if (confirm.Value)
                            {
                                isImWCnt = await DisplayAlert("导入单词本", "是否一并导入测验数据?", "好的", "不了");
                            }
                            var ret = DictService.Import(pic.Result, confirm.Value, isImWCnt);
                            hudPopup.Show(msg: "导入中");
                            if (await ret)
                            {
                                hudPopup.Show(HUDType.Success, "导入成功");
                            }
                            else
                            {
                                hudPopup.Show(HUDType.Fail, "导入失败");
                            }
                            RefreshWords();
                        }
                    }
                }
                catch (Exception e)
                {
                    e.CopeWith("importDB");
                }
            }
            else if (sender == clearCell)
            {
                var ret = await DisplayAlert("清空单词本", "此操作无法恢复", "确认", "不了");

                if (ret)
                {
                    DictService.Clear();
                    RefreshWords();
                }
            }
            else if (sender == debugCell)
            {
                var str = DictService.debugInfo();
                Navigation.PushAsync(new DebugPage("DBstat", str));
            }
            else if (sender == updCell)
            {
                DictService.updateDB();
            }
        }