Exemplo n.º 1
0
        private async void OnInsertKey(KeyboardEventArgs e)
        {
            if (e.Code == "Enter")
            {
                if (string.IsNullOrWhiteSpace(newTask.Title))
                {
                    await MsgSrv.Error("标题必须填写");

                    return;
                }

                isNewLoading = true;
                var result = await Http.PostAsJsonAsync("api/Task/SaveTask", newTask);

                if (result.IsSuccessStatusCode)
                {
                    newTask.TaskId = await result.Content.ReadFromJsonAsync <Guid>();

                    // await Task.Delay(1000);
                    if (OnInserted.HasDelegate)
                    {
                        await OnInserted.InvokeAsync(newTask);
                    }

                    newTask = NewTaskFunc?.Invoke();
                }
                else
                {
                    await MsgSrv.Error($"请求发生错误 {result.StatusCode}");
                }

                isNewLoading = false;
                StateHasChanged();
            }
        }
Exemplo n.º 2
0
        async Task OnSave()
        {
            if (!isEdit)
            {
                var result = await Http.PostFromJsonAsync <AppInputDto, MessageModel <bool> >($"api/App", model);

                if (result.success == true)
                {
                    await base.CloseAsync(result);

                    await MsgSrv.Success("新增成功");
                }
                else
                {
                    await MsgSrv.Error($"新增失败:{result.msg}");
                }
            }
            else
            {
                var result = await Http.PutFromJsonAsync <AppInputDto, MessageModel <bool> >($"api/App/{model.Id}", model);

                if (result.success == true)
                {
                    await base.CloseAsync(result);

                    await MsgSrv.Success("编辑成功");
                }
                else
                {
                    await MsgSrv.Error($"编辑失败:{result.msg}");
                }
            }
        }
Exemplo n.º 3
0
        public CEDHandler()
        {
            m_MCS          = new MsgSrv();
            m_clientCookie = m_MCS.LogOn("CEDHandler-" + System.Guid.NewGuid().ToString(), this);

            if (m_clientCookie == null)
            {
                return;
            }

            m_clientID     = m_clientCookie.PartnerID;
            m_subscription = m_MCS.Subscribe(m_clientID, "CedChallenge", "", "", "", "", "", 0);
        }
Exemplo n.º 4
0
        public CEDForm()
        {
            InitializeComponent();
            cedDescription.Visible = false;
            cedButton1.Visible     = false;
            cedButton2.Visible     = false;
            cedButton3.Visible     = false;
            cedButton4.Visible     = false;
            cedButton5.Visible     = false;

            m_MCS          = new MsgSrv();
            m_clientCookie = m_MCS.LogOn("CEDForm-" + System.Guid.NewGuid().ToString(), this);

            if (m_clientCookie == null)
            {
                return;
            }

            m_clientID     = m_clientCookie.PartnerID;
            m_subscription = m_MCS.Subscribe(m_clientID, "CedResponse", "", "", "", "", "", 0);
        }