Smobiler基于.NET框架开发移动应用内部系统(开发日志二)

请假的设计界面完成了,如何实现类别选择和审批人抄送人选择。
拖拉一个PopList控件。双击审批人按钮控件,进入事件,这里贴一张事件代码

<span style="font-size:14px;">    '获取审批人
 
    Private Sub BtnCUser_Click(sender As Object, e As EventArgs) Handles BtnCUser.Click, BtnCUser2.Click
 
        Dim frmLeave As New frmLeave(Session("UserID").ID)
 
        Dim table As DataTable = frmLeave.GetConfirmUser() '获取数据
 
        PopList1.Groups.Clear()
 
        Dim poli As New PopListGroup
 
        PopList1.Groups.Add(poli)
 
        poli.Text = "审批人"
 
        '显示选择列表中key和values
 
        For Each rowli As DataRow In table.Rows
 
            poli.Items.Add(rowli.Item("USER_ID"), rowli.Item("USER_ID"))
 
        Next
 
        PopList1.Show()
 
    End Sub</span>


 

 poplist选择后赋值代码

<span style="font-size:14px;">''' <summary>
 
    ''' poplist选择控件赋值审阅人
 
    ''' </summary>
 
    ''' <param name="sender"></param>
 
    ''' <param name="e"></param>
 
    ''' <remarks></remarks>
 
    Private Sub PopList1_Selected(sender As Object, e As EventArgs) Handles PopList1.Selected
 
        If PopList1.Selection IsNot Nothing Then
 
            CUser = PopList1.Selection.Value
 
            Me.BtnCUser.Text = PopList1.Selection.Text.Trim
 
        End If
 
    End Sub</span>


请假条创建界面的功能基本完成了,接下来就是对界面输入数据保存了。这里是通过ToolbarItemClick事件,具体代码如下:

<span style="font-size:14px;">'toolbar按钮触发事件
 
    Private Sub frmLeaveCreate_ToolbarItemClick(sender As Object, e As ToolbarClickEventArgs) Handles MyBase.ToolbarItemClick
 
        Try
 
            Select Case e.Name
 
                Case save.Name
 
                    If Me.isSaving Then
 
                        Return
 
                    End If
 
                    isSaving = True
 
                    '数据保存逻辑代码
 
                    '......
 
                    MessageBox.Show("请假条已创建成功!", Sub() Me.Close())
 
                Case tExit.Name
 
                    MessageBox.Show("是否确定返回?", MessageBoxButtons.YesNo, Sub(s As Object, args As MessageBoxHandlerArgs) If args.Result = Smobiler.Core.ShowResult.Yes Then Me.Close(), Nothing)
 
            End Select
 
        Catch ex As Exception
 
            MessageBox.Show(ex.Message)
 
        Finally
 
            isSaving = False
 
        End Try
 
    End Sub</span>


 

你可能感兴趣的:(.net,移动开发,Smobiler)