预览
代码
手机端效果
demoOfflineCameraButton.cs
demoOfflineCameraButton.Designer.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace Smobiler.Tutorials.Controls
{
partial class demoOfflineCameraButton : Smobiler.Core.Controls.MobileForm
{
public demoOfflineCameraButton() : base()
{
//This call is required by the SmobilerForm.
InitializeComponent();
}
private void title1_ImagePress(object sender, EventArgs e)
{
this.Close();
}
private void demoOfflineCameraButton_Load(object sender, EventArgs e)
{
PopListGroup pg1 = new PopListGroup();
pg1.Title = "Mode模式";
pg1.TitleVisible = true;
pg1.AddListItem("Camera");
pg1.AddListItem("CameraAndAlbum");
pg1.AddListItem("AlbumSingle");
pg1.AddListItem("Album");
pg1.AddListItem("CameraContinuous");
pg1.AddListItem("CameraVideo");
pg1.AddListItem("AlbumVideo");
PopListGroup pg2 = new PopListGroup();
pg2.TitleVisible = true;
pg2.Title = "AlbumCount可上传数";
pg2.AddListItem("3");
PopListGroup pg3 = new PopListGroup();
pg3.TitleVisible = true;
pg3.Title = "AllowEdit";
pg3.AddListItem("true");
pg3.AddListItem("false");
PopListGroup pg4 = new PopListGroup();
pg4.TitleVisible = true;
pg4.Title = "CompressedQuality压缩质量";
pg4.AddListItem("30");
pg4.AddListItem("60");
PopListGroup pg5 = new PopListGroup();
pg5.TitleVisible = true;
pg5.Title = "CompressedResolution压缩分辨率";
pg5.AddListItem("720");
pg5.AddListItem("1280");
PopListGroup pg6 = new PopListGroup();
pg6.TitleVisible = true;
pg6.Title = "QualityMode图像上传质量的模式";
pg6.AddListItem("Custom:用户自己选择上传方式");
pg6.AddListItem("Compressed:压缩上传");
pg6.AddListItem("Original:原图上传");
popList1.Groups.AddRange(new PopListGroup[] { pg1, pg2, pg3, pg4, pg5, pg6 });
}
private void button1_Press(object sender, EventArgs e)
{
popList1.ShowDialog();
}
private void offlineCameraButton1_OfflineImageCaptured(object sender, ResourcesResultArgs e)
{
//可在离线资源页上传图片,this.Form.Client.ShowOfflineResources()跳转离线资源页
if (e.isError == false)
{
for (int i = 0; i < e.ResourceIDs.Length; i++)
Toast(e.ResourceIDs[i]);
}
}
private void button2_Press(object sender, EventArgs e)
{
//跳转离线资源页
this.Form.Client.ShowOfflineResources();
}
private void popList1_Selected(object sender, EventArgs e)
{
switch (popList1.Selection.Text)
{
case "Camera":
offlineCameraButton1.Mode = CameraMode.Camera;
button1.Text = "Mode:Camera";
break;
case "CameraAndAlbum":
offlineCameraButton1.Mode = CameraMode.CameraAndAlbum;
button1.Text = "Mode:CameraAndAlbum"; break;
case "AlbumSingle":
offlineCameraButton1.Mode = CameraMode.AlbumSingle;
button1.Text = "Mode:AlbumSingle"; break;
case "Album":
offlineCameraButton1.Mode = CameraMode.Album;
button1.Text = "Mode:Album"; break;
case "CameraContinuous":
offlineCameraButton1.Mode = CameraMode.CameraContinuous;
button1.Text = "Mode:CameraContinuous"; break;
case "CameraVideo":
offlineCameraButton1.Mode = CameraMode.CameraVideo;
button1.Text = "Mode:CameraVideo"; break;
case "AlbumVideo":
offlineCameraButton1.Mode = CameraMode.AlbumVideo;
button1.Text = "Mode:AlbumVideo";
break;
case"3":
offlineCameraButton1.AlbumCount = 3;
button1.Text = "AlbumCount:3";
break;
case"true":
offlineCameraButton1.AllowEdit = true;
button1.Text = "AllowEdit:true";
break;
case"false":
offlineCameraButton1.AllowEdit = false;
button1.Text = "AllowEdit:false";
break;
case"30":
offlineCameraButton1.CompressedQuality = 30;
button1.Text = "CompressedQuality:30";
break;
case"60":
offlineCameraButton1.CompressedQuality = 60;
button1.Text = "CompressedQuality:60";
break;
case"720":
offlineCameraButton1.CompressedResolution = 720;
button1.Text = "CompressedResolution:720";
break;
case"1280":
offlineCameraButton1.CompressedResolution = 1280;
button1.Text = "CompressedResolution:1280";
break;
case"Custom:用户自己选择上传方式":
offlineCameraButton1.QualityMode = ImageQualityMode.Custom;
button1.Text = "Mode:AlbumVideo";
break;
case"Compressed:压缩上传":
offlineCameraButton1.QualityMode = ImageQualityMode.Compressed;
button1.Text = "Mode:AlbumVideo";
break;
case"Original:原图上传":
offlineCameraButton1.QualityMode = ImageQualityMode.Original;
button1.Text = "Mode:AlbumVideo";
break;
}
}
}
}
using System;
using Smobiler.Core;
namespace Smobiler.Tutorials.Controls
{
partial class demoOfflineCameraButton : Smobiler.Core.Controls.MobileForm
{
#region "SmobilerForm generated code "
//SmobilerForm overrides dispose to clean up the component list.
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
//NOTE: The following procedure is required by the SmobilerForm
//It can be modified using the SmobilerForm.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.title1 = new Smobiler.Core.Controls.Title();
this.panel1 = new Smobiler.Core.Controls.Panel();
this.popList1 = new Smobiler.Core.Controls.PopList();
this.panel2 = new Smobiler.Core.Controls.Panel();
this.button2 = new Smobiler.Core.Controls.Button();
this.button1 = new Smobiler.Core.Controls.Button();
this.offlineCameraButton1 = new Smobiler.Core.Controls.OfflineCameraButton();
this.labTitle = new Smobiler.Core.Controls.Label();
this.labContent = new Smobiler.Core.Controls.Label();
//
// title1
//
this.title1.ImageType = Smobiler.Core.Controls.ImageEx.ImageStyle.FontIcon;
this.title1.Name = "title1";
this.title1.ResourceID = "angle-left";
this.title1.Size = new System.Drawing.Size(300, 30);
this.title1.Text = "OfflineCameraButton";
this.title1.ImagePress += new System.EventHandler(this.title1_ImagePress);
//
// panel1
//
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel2});
this.panel1.Flex = 1;
this.panel1.Name = "panel1";
this.panel1.Scrollable = true;
this.panel1.Size = new System.Drawing.Size(0, 100);
//
// popList1
//
this.popList1.Name = "popList1";
this.popList1.Selected += new System.EventHandler(this.popList1_Selected);
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.White;
this.panel2.Border = new Smobiler.Core.Controls.Border(1F);
this.panel2.BorderColor = System.Drawing.Color.Silver;
this.panel2.BorderRadius = 5;
this.panel2.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.labContent,
this.labTitle,
this.offlineCameraButton1,
this.button1,
this.button2});
this.panel2.Location = new System.Drawing.Point(5, 9);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(290, 674);
//
// button2
//
this.button2.BackColor = System.Drawing.Color.DeepSkyBlue;
this.button2.Location = new System.Drawing.Point(36, 310);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(212, 30);
this.button2.Text = "查看离线资源";
this.button2.Press += new System.EventHandler(this.button2_Press);
//
// button1
//
this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(192)))), ((int)(((byte)(78)))));
this.button1.Location = new System.Drawing.Point(36, 152);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(212, 30);
this.button1.Text = "控件介绍";
this.button1.Press += new System.EventHandler(this.button1_Press);
//
// offlineCameraButton1
//
this.offlineCameraButton1.Location = new System.Drawing.Point(102, 217);
this.offlineCameraButton1.Mode = Smobiler.Core.Controls.CameraMode.Camera;
this.offlineCameraButton1.Name = "offlineCameraButton1";
this.offlineCameraButton1.ResourceID = "CameraOffline";
this.offlineCameraButton1.Size = new System.Drawing.Size(81, 67);
this.offlineCameraButton1.OfflineImageCaptured += new Smobiler.Core.Controls.CameraOfflineCallBackHandler(this.offlineCameraButton1_OfflineImageCaptured);
//
// labTitle
//
this.labTitle.BackColor = System.Drawing.Color.WhiteSmoke;
this.labTitle.Border = new Smobiler.Core.Controls.Border(0F, 0F, 0F, 1F);
this.labTitle.BorderColor = System.Drawing.Color.DarkSeaGreen;
this.labTitle.FontSize = 16F;
this.labTitle.Name = "labTitle";
this.labTitle.Padding = new Smobiler.Core.Controls.Padding(5F);
this.labTitle.Size = new System.Drawing.Size(290, 26);
this.labTitle.Text = "离线拍照组件\r\n";
//
// labContent
//
this.labContent.BackColor = System.Drawing.Color.WhiteSmoke;
this.labContent.FontSize = 15F;
this.labContent.Location = new System.Drawing.Point(0, 26);
this.labContent.Name = "labContent";
this.labContent.Padding = new Smobiler.Core.Controls.Padding(5F);
this.labContent.Size = new System.Drawing.Size(290, 106);
this.labContent.Text = "调用摄像头或相册进行图片获取\r\nImageType设置按钮图像类型\r\nResourceID设置按钮图像资源名称\r\nResourcePath设置按钮图像存储路径\r\n" +
"OfflineImageCaptured事件在客户端返货离线资源时触发\r\n\r\n";
this.labContent.VerticalAlignment = Smobiler.Core.Controls.VerticalAlignment.Top;
//
// demoOfflineCameraButton
//
this.Components.AddRange(new Smobiler.Core.Controls.MobileComponent[] {
this.popList1});
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.title1,
this.panel1});
this.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.Load += new System.EventHandler(this.demoOfflineCameraButton_Load);
this.Name = "demoOfflineCameraButton";
}
#endregion
private Core.Controls.Title title1;
private Core.Controls.Panel panel1;
private Core.Controls.PopList popList1;
private Core.Controls.Panel panel2;
private Core.Controls.Label labContent;
private Core.Controls.Label labTitle;
private Core.Controls.OfflineCameraButton offlineCameraButton1;
private Core.Controls.Button button1;
private Core.Controls.Button button2;
}
}