Inheritance: CustomTypeHelper
Example #1
0
        //保存照片
        public void SaveImage()
        {
            DefaultCaputerSource dcs = Application.Current.Resources[DefaultCaputerName] as DefaultCaputerSource;

            if (dcs.CutImage != null)
            {
                IsBusy = true;
                if (tempid == null)
                {
                    tempid = System.Guid.NewGuid().ToString();
                }
                byte[]    by        = Convert.FromBase64String(GetBase64Image(dcs.CutImage));
                Stream    sr        = new MemoryStream(by);
                WebClient webclient = new WebClient();
                Uri       uri       = new Uri(Path + "?FileName=" + FileName + "&BlobId=" + tempid + "&EntityName=" + EntityName);
                webclient.OpenWriteCompleted     += new OpenWriteCompletedEventHandler(webclient_OpenWriteCompleted);
                webclient.Headers["Content-Type"] = "multipart/form-data";
                webclient.OpenWriteAsync(uri, "POST", sr);
                webclient.WriteStreamClosed += new WriteStreamClosedEventHandler(webclient_WriteStreamClosed);
            }
            else
            {
                MessageBox.Show("请拍照!");
            }
        }
Example #2
0
        private static void OnIsInitChanged(DependencyObject dp, DependencyPropertyChangedEventArgs args)
        {
            DefaultCaputerObject go = (DefaultCaputerObject)dp;

            //如果指明Path改变时,不加载数据,则只有当外界要求,加载数据时,才加载
            if (go.IsInit)
            {
                go.tempid = null;
                go.BlobId = null;
                DefaultCaputerSource dcs = Application.Current.Resources[go.DefaultCaputerName] as DefaultCaputerSource;
                dcs.CutImage = null;
            }
        }
Example #3
0
        //执行拍照
        public void CaptureImageAnsync()
        {
            DefaultCaputerSource dcs = Application.Current.Resources[DefaultCaputerName] as DefaultCaputerSource;

            dcs.Video.CaptureImageAsync();
        }