private void Add(Object paramater) { NavigationHelp.NavigateTo(typeof(NewOrEditView)); }
public async void HttpPost(string uid, string uimage, string name, string content, List <string> imagePsthList, string songPath, string date, int type) { NotifyControl notify = new NotifyControl(); notify.Text = "亲,努力发送中..."; notify.Show(); HttpClient httpClient = new HttpClient(); uint MaxImageWidth = 480; uint MaxImageHeight = 800; uint width; uint height; try { string posturi = Config.apiDreamingPublish; HttpMultipartFormDataContent fileContent = new HttpMultipartFormDataContent(); if (imagePsthList.Count > 0) { for (int i = 0; i < imagePsthList.Count; i++) { StorageFile inFile = await StorageFile.GetFileFromPathAsync(imagePsthList[i]); var inStream = await inFile.OpenReadAsync(); InMemoryRandomAccessStream outStream = new InMemoryRandomAccessStream(); BitmapDecoder decoder = await ImageHelp.GetProperDecoder(inStream, inFile); if (decoder == null) { return; } if (decoder.OrientedPixelWidth > MaxImageWidth && decoder.OrientedPixelHeight > MaxImageHeight) { width = MaxImageWidth; height = MaxImageHeight; } else { width = decoder.OrientedPixelWidth; height = decoder.OrientedPixelHeight; } PixelDataProvider provider = await decoder.GetPixelDataAsync(); byte[] data = provider.DetachPixelData(); //获取像素数据的字节数组 BitmapPropertySet propertySet = new BitmapPropertySet(); BitmapTypedValue qualityValue = new BitmapTypedValue(0.5, PropertyType.Single); propertySet.Add("ImageQuality", qualityValue); var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.JpegEncoderId, outStream, propertySet);//建立编码器 encoder.SetPixelData(decoder.BitmapPixelFormat, decoder.BitmapAlphaMode, decoder.OrientedPixelWidth, decoder.OrientedPixelHeight, decoder.DpiX, decoder.DpiY, data ); encoder.BitmapTransform.ScaledWidth = width; encoder.BitmapTransform.ScaledHeight = height; await encoder.FlushAsync(); HttpStreamContent streamContent1 = new HttpStreamContent(outStream); fileContent.Add(streamContent1, "pic", inFile.Name); } } if (songPath != null) { StorageFile file1 = await StorageFile.GetFileFromPathAsync(songPath); IRandomAccessStreamWithContentType stream1 = await file1.OpenReadAsync(); HttpStreamContent streamContent1 = new HttpStreamContent(stream1); fileContent.Add(streamContent1, "song", file1.Name); } HttpStringContent stringContent = new HttpStringContent(content); HttpStringContent stringName = new HttpStringContent(name); HttpStringContent stringUid = new HttpStringContent(uid); HttpStringContent stringUimage = new HttpStringContent(uimage); HttpStringContent stringTime = new HttpStringContent(date); HttpStringContent stringType = new HttpStringContent(type.ToString()); fileContent.Add(stringContent, "content"); fileContent.Add(stringUid, "phone"); fileContent.Add(stringUimage, "uimage"); fileContent.Add(stringName, "name"); fileContent.Add(stringTime, "time"); fileContent.Add(stringType, "type"); HttpResponseMessage response = await httpClient.PostAsync(new Uri(posturi), fileContent); Init(); notify.Hide(); PostCommand.CanExecutes = true; NavigationHelp.NavigateTo(typeof(AllDreaming)); } catch (Exception ex) { HelpMethods.Msg(ex.Message.ToString()); } }
private void Edit(Object paramater) { Guid id = (Guid)paramater; NavigationHelp.NavigateTo(typeof(NewOrEditView), id); }
public void Register() { NavigationHelp.NavigateTo(typeof(UserRegister)); }
private void Cancel() { NavigationHelp.NavigateTo(typeof(MainPage)); }
private void Add() { App.DataModel.AddNote(NoteDemo); NavigationHelp.NavigateTo(typeof(MainPage)); }
private void Modify() { App.DataModel.UpdateNote(NoteDemo); NavigationHelp.NavigateTo(typeof(MainPage)); }
private async void acc_ReadingChanged(Accelerometer sender, AccelerometerReadingChangedEventArgs args) { double x = args.Reading.AccelerationX * 100d; double y = args.Reading.AccelerationY * 100d; double z = args.Reading.AccelerationZ * 100d; await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { if (Math.Abs(x) > 145d || Math.Abs(y) > 140d || Math.Abs(z) > 155d) { if (App.appSettings.Values.ContainsKey("YaoYao")) { switch (App.appSettings.Values["YaoYao"].ToString()) { case "定位": { where (); break; } case "路线导航": { navigate(); break; } case "指南针": { NavigationHelp.NavigateTo(typeof(CompassView)); break; } case "公交换乘": { NavigationHelp.NavigateTo(typeof(BusTransfer)); break; } case "公交路线": { NavigationHelp.NavigateTo(typeof(BusRoute)); break; } case "公交站点": { NavigationHelp.NavigateTo(typeof(BusStation)); break; } case "周边公交": { NavigationHelp.NavigateTo(typeof(BusAround)); break; } case "周边美食": { NavigationHelp.NavigateTo(typeof(BusinessView), "美食"); break; } case "周边酒店": { NavigationHelp.NavigateTo(typeof(BusinessView), "酒店"); break; } case "周边娱乐": { NavigationHelp.NavigateTo(typeof(BusinessView), "娱乐"); break; } case "周边购物": { NavigationHelp.NavigateTo(typeof(BusinessView), "购物"); break; } case "周边景点": { NavigationHelp.NavigateTo(typeof(BusinessView), "景点"); break; } } } else { NavigationHelp.NavigateTo(typeof(BusRoute)); } } }); }