Ejemplo n.º 1
0
        private void listMenuView1_ItemPress(object sender, ListMenuViewItemPressEventArgs e)
        {
            switch (e.Item.Tag.ToString())
            {
            case "demoListViewRefresh":
                this.Show(new demoListViewRefresh());
                break;

            case "userFilter":
                //Dialog显示的自定义控件,如果重复使用,不需要每一次都实例化,如果需要实例化,记得把原来的给Destroy
                if (filter == null)
                {
                    //由于内部使用了Flex布局,需要在外部给定高度
                    filter           = new userFilter();
                    filter.Height    = 400;
                    filter.BackColor = System.Drawing.Color.White;
                    //最后一个参数代表支持点击空白处关闭
                    filterOptions = new DialogOptions(LayoutJustifyAlign.FlexEnd, System.Drawing.Color.FromArgb(128, 128, 128, 128), Padding.Empty, true);
                }
                this.ShowDialog(filter, filterOptions);
                break;

            case "userFooterDialog":
                //Dialog显示的自定义控件,如果重复使用,不需要每一次都实例化,如果需要实例化,记得把原来的给Destroy
                if (footerDialog == null)
                {
                    //由于内部控件都有了高度,所以userFooterDialog不用设置高度,会自动撑大
                    footerDialog = new SmobilerSamples.ShowDialog.userFooterDialog();
                    //最后一个参数代表支持点击空白处关闭
                    footerDialogOptions = new DialogOptions(LayoutJustifyAlign.FlexEnd, System.Drawing.Color.FromArgb(128, 128, 128, 128), Padding.Empty, true);
                }
                this.ShowDialog(footerDialog, footerDialogOptions);
                break;

            case "userDialogPassword":
                if (footerDialogOptions == null)
                {
                    footerDialogOptions = new DialogOptions(LayoutJustifyAlign.FlexEnd, System.Drawing.Color.FromArgb(128, 128, 128, 128), Padding.Empty, true);
                }
                ShowDialog.userDialogPassword dialogPassowrd = new ShowDialog.userDialogPassword();
                dialogPassowrd.DialogPassword += (pass) => { MessageBox.Show(pass); };
                this.ShowDialog(dialogPassowrd, footerDialogOptions);
                break;

            case "demogetdata":
                demogetdata dm = new demogetdata();
                dm.Selected += (obj, args) => { Toast(args.Text); };
                this.ShowDialog(dm);
                break;

            case "demoWebView":
                this.Show(new demoWebView());
                break;

            case "demoCustomResource":
                this.Show(new demoCustomResource());
                break;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 处理ListMenuView的元素点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listMenuView1_ItemPress(object sender, ListMenuViewItemPressEventArgs e)
        {
            switch (e.Item.Tag.ToString())
            {
            case "demoListViewRefresh":
                //显示demoListViewRefresh窗体
                this.Show(new demoListViewRefresh());
                break;

            case "userFilter":
                //Dialog显示的自定义控件,如果重复使用,不需要每一次都实例化,如果需要实例化,记得把原来的给Destroy
                if (filter == null)
                {
                    //由于内部使用了Flex布局,需要在外部给定高度
                    filter           = new userFilter();
                    filter.Height    = 400;
                    filter.BackColor = System.Drawing.Color.White;

                    /* DialogOptions参数说明
                     * justifyAlign: LayoutJustifyAlign.FlexEnd 布局显示在最下面
                     * backColor: System.Drawing.Color.FromArgb(128, 128, 128, 128) 整个Dialog的背景色
                     * padding: Padding.Empty 设置内边框为空,就是全屏显示
                     * touchClosed: true 是否点击空白处关闭
                     */
                    filterOptions = new DialogOptions(justifyAlign: LayoutJustifyAlign.FlexEnd, backColor: System.Drawing.Color.FromArgb(128, 128, 128, 128), padding: Padding.Empty, touchClosed: true);
                }
                //弹出filter
                this.ShowDialog(filter, filterOptions);
                break;

            case "userFooterDialog":
                //Dialog显示的自定义控件,如果重复使用,不需要每一次都实例化,如果需要实例化,记得把原来的给Destroy
                if (footerDialog == null)
                {
                    //由于内部控件都有了高度,所以userFooterDialog不用设置高度,会自动撑大
                    footerDialog = new SmobilerSamples.ShowDialog.userFooterDialog();

                    //同case "userFilter":中的参数设定
                    footerDialogOptions = new DialogOptions(LayoutJustifyAlign.FlexEnd, System.Drawing.Color.FromArgb(128, 128, 128, 128), Padding.Empty, true);
                }
                //弹出footerDialog
                this.ShowDialog(footerDialog, footerDialogOptions);
                break;

            case "userDialogPassword":
                if (footerDialogOptions == null)
                {
                    //同case "userFilter":中的参数设定
                    footerDialogOptions = new DialogOptions(LayoutJustifyAlign.FlexEnd, System.Drawing.Color.FromArgb(128, 128, 128, 128), Padding.Empty, true);
                }
                //创建userDialogPassword用户控件实例
                ShowDialog.userDialogPassword dialogPassowrd = new ShowDialog.userDialogPassword();
                //绑定DialogPassword事件
                dialogPassowrd.DialogPassword += (pass) => { MessageBox.Show(pass); };
                //弹出dialogPassowrd
                this.ShowDialog(dialogPassowrd, footerDialogOptions);
                break;

            case "demogetdata":
                //创建demogetdata用户控件实例
                demogetdata dm = new demogetdata();
                //绑定demogetdata的Selected事件
                dm.Selected += (obj, args) => { Toast(args.Text); };
                //弹出Dialog
                this.ShowDialog(dm);
                break;

            case "demoWebView":
                //显示demoWebView窗体
                this.Show(new demoWebView());
                break;

            case "demoCustomResource":
                //显示demoCustomResource窗体
                this.Show(new demoCustomResource());
                break;
            }
        }