Пример #1
0
 private async void AddExec()
 {
     InfoManagerService.InfoManagerServiceClient client = new InfoManagerService.InfoManagerServiceClient();
     try
     {
         var addTask = client.AddFlgAsync(this.Flg);
         await addTask;
         Messenger.Default.Send<GenericMessage<string>>(new GenericMessage<string>("Add"), "FlgFlyOut");
         Messenger.Default.Send<GenericMessage<string>>(new GenericMessage<string>("RefreshFlg"), "RefreshFlg");
     }
     catch (System.Exception ex)
     {
         Messenger.Default.Send<GenericMessage<System.Exception>>(new GenericMessage<System.Exception>(ex), "FlgError");
     }
     finally
     {
         client.Close();
     }
 }
        private void EditExec()
        {
            InfoManagerService.InfoManagerServiceClient client = new InfoManagerService.InfoManagerServiceClient();
            try
            {
                client.Open();
                client.UpdateTarget(GetModel());

                Messenger.Default.Send<GenericMessage<string>>(new GenericMessage<string>("EditProduct"), "flyOut");
            }
            catch (System.Exception ex)
            {
                Messenger.Default.Send<GenericMessage<System.Exception>>(new GenericMessage<System.Exception>(ex), "InfoError");
                //TODO save the messenger!!
            }
            finally
            {
                client.Close();
            }
        }
Пример #3
0
        private async void EditExec()
        {
            InfoManagerService.InfoManagerServiceClient client = new InfoManagerService.InfoManagerServiceClient();
            try
            {
                client.Open();
                var editTask = client.UpdateFlgAsync(this.Flg);
                await editTask;

                Messenger.Default.Send<GenericMessage<string>>(new GenericMessage<string>("Edit"), "FlgFlyOut");
            }
            catch (System.Exception ex)
            {
                Messenger.Default.Send<GenericMessage<System.Exception>>(new GenericMessage<System.Exception>(ex), "FlgQueryError");
            }
            finally
            {
                client.Close();
            }
        }
Пример #4
0
 private async void RefreshExec()
 {
     InfoManagerService.InfoManagerServiceClient client = new InfoManagerService.InfoManagerServiceClient();
     try
     {
         client.Open();
         var queryTask = client.GetFlgs1Async(this.Info.Id, _mold);
         this.FlgList = new List<InfoManagerService.Flg>(await queryTask);
     }
     catch (System.Exception ex)
     {
         Messenger.Default.Send<GenericMessage<System.Exception>>(new GenericMessage<System.Exception>(ex), "FlgError");
     }
     finally
     {
         client.Close();
     }
 }
Пример #5
0
        async private Task<bool> TestConnExec()
        {
            SystemMenagerService.SystemManagerServiceClient sm = new SystemMenagerService.SystemManagerServiceClient();
            LogService.LogServiceClient lv = new LogService.LogServiceClient();
            InfoManagerService.InfoManagerServiceClient im = new InfoManagerService.InfoManagerServiceClient();

            bool testConnRet = false;
            string lToken = System.Configuration.ConfigurationManager.AppSettings["localToken"];
            try
            {
                var ran = new System.Random();
                var token = ran.Next(int.MaxValue).ToString();

                sm.Open();
                Task<int> testsm = sm.TestConnAsync(token);
                lv.Open();
                Task<int> testLv = lv.TestConnAsync(token);
                im.Open();
                Task<int> testIm = im.TestConnAsync(token);

                int smRet = await testsm;
                int imRet = await testIm;
                int lvRet = await testLv;

                testConnRet = (smRet == (token+lToken).GetHashCode()) || (smRet == imRet) || (smRet == lvRet);
            }
            catch (System.Exception)
            {
                this.IsChecking = false;
                Messenger.Default.Send<GenericMessage<string>>(new GenericMessage<string>("fail"), "connFail");
                return false;
            }

            finally
            {
                sm.Close();
                lv.Close();
                im.Close();
            }
            this.IsChecking = false;
            if (testConnRet)
                Messenger.Default.Send<GenericMessage<string>>(new GenericMessage<string>("success"), "loginSuccess");
            else
                Messenger.Default.Send<GenericMessage<string>>(new GenericMessage<string>("fail"), "connFail");
            this.Title = "登录";
            return true;
        }