Tag: windows phone 8

如何从页面中的App.xaml获取颜色值

我已经宣布了一种颜色,我将在我的应用程序中大量使用,我希望能够在页面中调用该特定颜色。 这种颜色最有可能用于XAML以及后面的代码。 在App.xaml我有 但是我如何在我的Page的UI和代码中调用它呢? 实际上要注意,上面在App.xaml中设置颜色会在启动时出现调试错误? public App() { // Standard XAML initialization InitializeComponent(); //XamlParseException occurs here … } 编辑** SolidColorBrush更新无法正常工作 我有一个Slider控件和两个在XAML中声明的ToggleSwitch控件,我希望在XAML中更改Slider前景并更改后面代码中的ToggleSwitch控件。 两者都不起作用 App.xaml中 因此,当尝试在XAML中更改Slider控件前景时,我没有使用错误 Foreground=”{StaticResource ThemeBrushBlue}” 但是在后面的代码中更改ToggleSwitch前台时我得到一个错误说明Cannot implicitly convert type ‘object’ to ‘System.Windows.Media.Brush’ this.ToggleSwitch.SwitchForeground = Application.Current.Resources[“ThemeBrushBlue”];

在Windows Phone 8中以编程方式(逐个单元格)读取/导入现有Excel文件

我正在使用Windows Phone 8应用程序来读取/写入Excel文件。 我在这里问了一个问题和提供的评论以及许多其他链接让我转向OpenXml 。 所有这些让我对如何创建 Excel文件以及如何启动它有了很好的了解。 但是现在我陷入了这些所有的基本问题,即如何读取现有的Excel文件(可能是使用MS Excel在外部创建)逐个单元格,即我想通过我的代码访问每个单元格及其值。 在openXML中我做了这个: Stream localFile = App.GetResourceStream(new Uri(“/ReadExcel;component/jai.xlsx” ,UriKind.Relative)).Stream; MemoryStream ms = new MemoryStream(); localFile.CopyTo(ms); DocumentFormat.OpenXml.Packaging.SpreadsheetDocument spreadsheetDoc = DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Open(localFile, true); { var a = spreadsheetDoc.Package; // Do work here } 但它给了我错误: The type ‘System.IO.Packaging.Package’ is defined in an assembly that is not referenced. You must add a reference […]

如何从我的Windows Phone 8应用程序(XAML和C#)访问相机并将拍摄的图片保存在确定的文件夹中?

我希望此时正在构建的Windows Phone 8应用程序在按下屏幕上的具体按钮时访问相机拍照,然后将已拍摄的图像保存到确定的文件夹中(创建的文件夹)我的Windows Phone项目,而不是Windows Phone默认图库。 你能帮我看一下相机,把照片保存到我创建的文件夹中吗? 我正在使用XAML和C#。 非常感谢!!!

分组LongListSelector:标题出现,项目不出现

C#中的WinPhone 8项目。 我正在尝试填充分组列表。 显示组标题,但项目不显示。 相关代码是: class MyPage { public class Group : IGrouping { public string Title{get;set;} public string[] Items; public string Key { get { return Title; } } public IEnumerator GetEnumerator() { return (Items as IEnumerable).GetEnumerator(); } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return Items.GetEnumerator(); } } private Group[] m_ItemGroups = { new Group(){Title = “A”, […]

我的漫游数据不会在设备之间同步

我做了一个UWP应用程序。 我使用roamingdata.I保存设置: public static void WriteCode(string pwd) { ApplicationDataContainer RoamingSettings = ApplicationData.Current.RoamingSettings; RoamingSettings.Values[“Code”] = EncryptHelper.PwdEncrypt(pwd); } 我通过这个阅读了这个设置: public static string GetCode() { ApplicationDataContainer RoamingSettings = ApplicationData.Current.RoamingSettings; string str = (String)RoamingSettings.Values[“Code”]; if (!String.IsNullOrEmpty(str)) return str; else return EncryptHelper.PwdEncrypt(“123”); } 我完成应用程序并上传到Windows商店并通过检查。 然后我在手机上下载这个应用程序。 我在手机上更改了ApplicationData.Current.RoamingSettings。 我在手机上的ApplicationData.Current.RoamingFolder上写了一些东西。 接下来,我关闭手机上的应用程序并在我的电脑上下载应用程序。 但是当我在PC上打开应用程序时,我发现ApplicationData.Current.RoamingSettings和ApplicationData.Current.RoamingFolder没有改变任何东西。 我在我的电脑上检查了C:\ Users \ XXX \ AppData \ Local \ Packages \ […]

任务状态:等待激活-DownloadStringTaskAsync -WP8

任务的状态始终是“等待激活”。任务的结果=“”。 我不明白为什么…感谢您的帮助UI调用GetDocLibs方法。 public class ServerFunctions { public static List GetDocLibs(bool onlyDocLibPerso) { string xmlContent = GetXml(); List result = BdeskDocLib.GetListFromXml(xmlContent, onlyDocLibPerso); return result; } private static String GetXml() { Tasktask=requesteur.Query(dataRequestParam); task.Wait(); xmlResult = task.Result; return xmlResult; } } public class DataRequest { public Task Query(DataRequestParam dataRequestParam) { try { WebClient web = new WebClient(); if […]

如何为stackpanel实现click事件

我在这里检查了stackpanel类http://msdn.microsoft.com/en-us/library/system.windows.controls.stackpanel.aspx ,它没有点击事件。 我正在开发一个Windows Phone 8应用程序,我在堆栈面板上有一个文本框和一些按钮。 我想要包含一个可以单击stackpanel的function,然后将其上的控件的可见性设置为折叠,然后再次单击它们时它们将变为可见。 我该怎么做呢?

使用POST请求将JSON发送到Jira API时的System.Net.WebException

好吧,伙计们,我已经在这个问题上挣扎了一天左右,没有明确的解决方案。 我将从例外开始: The remote server returned an error: NotFound. at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state) at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) 我正在尝试连接到JIRA rest API以登录用户。 我们的JIRA系统目前运行4.4.1,我试图访问的API信息在此处记录: https : //developer.atlassian.com/static/rest/jira/4.4.1.html 。 (请参阅“/ auth / 1 / session”API的POST请求) API调用POST请求,其中包含用户凭据的JSON正文。 我已尝试手动构建JSON,以及使用JSON库,结果是相同的。 我发送的json是: { “username”: “test”, “password”: “test” } 我试图将内容类型和编码更改为我能想象的任何内容。 这包括“text / json”,“application / json”,将Encoding.UTF8添加到流编写器等。所有结果都是相同的。 也许这整个考验中最令人沮丧的部分是,我能够立刻用Java for Android编写这个,所以我不认为这是一个API误解,就像Windows Phone 8和/或C#一样误解。 最后要指出的几点: 如果我更改代码以使用GET请求,请指向“http://www.google.com”,并删除请求回调(直接跳到响应),一切正常,我得到了我期望的结果。 我对HttpWebRequest的“BeginX”“EndX”方法感到困惑。 我理解异步任务,但不完全是C#如何管理它。 […]

带有自定义标头的Windows Phone 8 Http请求

我想从Windows Phone 8向WCF服务器发送HTTP PUT请求,为了识别,我必须发送自定义标头。 (假设“mycustomheader”=“abc”) 到目前为止我使用的是WebClient ,但是Webclient.Headers似乎没有Add方法,因此除了HttpRequestHeader枚举中的标题之外,不可能发送标题。 有没有办法用WebClient做到这一点? 我看到可以使用HttpWebRequest类设置自定义标头,但我根本无法让它做任何事情。 我的测试代码(基本上是从http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.begingetrequeststream.aspx复制的样本): public void dosth() { HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(“http://mycomputer/message”); wr.Method = “PUT”; wr.ContentType = “application/x-www-form-urlencoded”; wr.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback), wr); allDone.WaitOne(); } private static void GetRequestStreamCallback(IAsyncResult asynchronousResult) { HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState; Stream postStream = request.EndGetRequestStream(asynchronousResult); string postData = “{‘Command’: { ‘RequestType’ : ‘Status’, ‘Test’ : ‘1’ }}”; […]

如何更改/设置Windows Phone 8中的默认fontfamily

我想将我的应用程序的默认字体更改为自定义字体。 我可以为组件更改它,但有什么办法可以将任何fontfamily设置为所有组件的默认值?