A Windows Phone 7 app, it seems, has two places with version number - one in AssemblyInfo.cs (via AssemblyVersion/AssemblyFileVersion attributes), the other is WMAppManifest.xml. Those two seem uncorrelated - changing one does not affect the other. The Marketplace, it seems, uses the one from the manifest - can someone please confirm this?
The real question is - how do I retrieve the one from manifest programmatically to display on the About screen?
The WmAppManifest.xml number is in use. First two digits are relevant for Marketplace (it is checked when you do the update) next two are for your internal usage.
This is a regular XML file, open it as a XDocument and parse it. An example.
EDIT: the example is extraneous. For just the version, use:
string Version = XDocument.Load("WMAppManifest.xml")
.Root.Element("App").Attribute("Version").Value;
To get App Version from "WMappManifest.xml", this solution might be a bit more efficient than lukas solution:
For WP7:
var xmlReaderSettings = new XmlReaderSettings
{
XmlResolver = new XmlXapResolver()
};
using (var xmlReader = XmlReader.Create("WMAppManifest.xml", xmlReaderSettings))
{
xmlReader.ReadToDescendant("App");
return xmlReader.GetAttribute("Version");
}
For WP8:
using (var stream = new FileStream("WMAppManifest.xml", FileMode.Open, FileAccess.Read))
{
string appVersion = XElement.Load(stream).Element("App").Attribute("Version").Value;
}
Related
Refers to this thread : Is there a way to activate IE mode in Edge Options?
It may sound like a duplicate, but my question is not if automating IE Mode in Edge is possible or not, but if it is possible for Ruby. So far, I only saw the code that can run Edge in IE mode in C#, VB.NET, etc but not in Ruby.
Here is the code I refer to :
static void Main(string[] args)
{
var dir = "{FULL_PATH_TO_IEDRIVERSERVER}";
var driver = "IEDriverServer.exe";
if (!Directory.Exists(dir) || !File.Exists(Path.Combine(dir, driver)))
{
Console.WriteLine("Failed to find {0} in {1} folder.", dir, driver);
return;
}
var ieService = InternetExplorerDriverService.CreateDefaultService(dir, driver);
var ieOptions = new InternetExplorerOptions{};
ieOptions.AddAdditionalCapability("ie.edgechromium", true);
ieOptions.AddAdditionalCapability("ie.edgepath", #"\\msedge.exe");
var webdriver = new InternetExplorerDriver(ieService, ieOptions, TimeSpan.FromSeconds(30));
webdriver.Url = "http://www.example.com";
}
If Ruby supports these features, please let me know or share where I can go to look for the solution.
I didn't find related information about using Ruby to automate Edge IE mode. AFAIK, it only works with C#, VB.NET and Python now.
You can have a try to set the same IE capabilities in Ruby, if it doesn't work, then I think Ruby doesn't support the capabilities either. In this situation, you can raise a new issue about adding these features in IE WebDriver on Selenium GitHub as IE WebDriver is maintained by Selenium.
If you're using selenium 3, add those 2 new capabilities into the desired capabilities payload
If you're using selenium 4, add those 2 new capabilities to the first part of the capabilities array.
The names look W3C-like, so in theory they "should" just work. But I've never heard of anyone even wanting to automate this (i.e. what is the real world use case)
Based on this WWDC2018 video, we can dynamically change how words are pronounced in AVSpeechSynthesizer.
I'm trying to do that in my Xamarin App, but I can't find the accessibilitySpeechIPANotation constant.
In the doc of NSMutableAttributedString.AddAttribute(...) it says that the constants can be found here: UIKit.UIStringAttributeKey. Yet the one I'm looking for isn't there.
Does anyone know what the actual string value of the constant is? Or even better, where I can find in in Xamarin.iOS?
(My app uses xamarin.ios v4.0.30319, if the constant is in a newer version of the framework, I'll update it, but google doesn't seem to give me any result when I search for it.)
Cause:
Xamarin for iOS is based on Objective-C.And there are some differences between swift and Objective-C.
Solution:
The code is just like the following :
var attriStrng = new NSMutableAttributedString(new NSString("hello iPhone"));
// you can set the voice here ,a͡͡a͡͡a͡͡a͡͡a͡͡ is just for testing
attriStrng.AddAttribute(new NSString("AVSpeechSynthesisIPANotationAttribute"), new NSString("ˈa͡͡a͡͡a͡͡a͡͡a͡͡a͡͡a͡͡.ˈfo͡ʊn"),new NSRange(6,6));
var voice = new AVSpeechUtterance(attriStrng);
AVSpeechSynthesizer synthesizer = new AVSpeechSynthesizer();
synthesizer.SpeakUtterance(voice);
I have a column ("DataDict") storing type of Dictionary (let say the variable name is call "dataDict")
Recently I've updated to Parse Unity 1.6.2 and I found out that whenever I make an update to dataDict, it doesn't get updated to the server.
For example:
Dictionary<string, object> dict = ParseUser.CurrentUser["DataDict"] as Dictionary<string, object>;
dict["name"] = "something new";
// after I call ParseUser.CurrentUser.SaveAsync()
// the server should have updated the dictionary
// but it's no longer working as what I expected after I've updated to Parse 1.6.2
Does anyone know what's going on?
I noticed one of the keypoint that listed in the changelogs:
Removed 'mutable containers' functionality, significantly enhances performance.
Does this affected my codes? How should I fix it?
I've solved this by calling
ParseUser.CurrentUser["DataDict"] = dict;
This question already has an answer here:
Is Isolated Storage Always Necessary?
(1 answer)
Closed 7 years ago.
i am writing a simple wp7 application that uses isolated storage concept. i could successfully complete the app but while trying to test if it works properly, i am getting an error stating "abc.xml" file is missing in the zap.
abc.xml is created using the code:
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
using (var fs = store.OpenFile("abc.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
var root = new XElement("User");
var Mobile_Number = new XElement("Mobile_NUmber", txtMobNum.Text);
var Sec_Ques = new XElement("Sec_Ques", secQues);
var xDoc = new XDocument();
root.Add(Mobile_Number, Sec_Ques);
xDoc.Add(root);
xDoc.Save(fs);
fs.Close();
}
}
if i add abc.xm to the solution, the err is cleared, but i do not think this is the right way to do. can someone help me out
thanks in advance
Any file created in isolated storage on one run of your application isn't considered to be part of the application to be deployed to other devices, no.
If you have a file you want to ship with the application, you should include it explicitly in your project.
Your question is answered here.
I know there are tools to get text files to resource files for Visual Studio. But I want to get the text from my resource files to a text file so they can be translated. Or is there a better way to do this?
You could use Resx Editor, a small translation-oriented file editor.
Target audience: translators.
Supported file format: Microsoft RESX 2.0
Here is a link to Joannès Vermoel's (the author of the free tool) weblog entry about it.
In the end I just used a quick hack:
public class Export
{
public string Run()
{
var resources = new StringBuilder();
var assembly = Assembly.GetExecutingAssembly();
var types = from t in assembly.GetTypes()
where t != typeof(Export)
select t;
foreach (Type t in types)
{
resources.AppendLine(t.Name);
resources.AppendLine("Key, Value");
var props = from p in t.GetProperties()
where !p.CanWrite && p.Name != "ResourceManager"
select p;
foreach (PropertyInfo p in props)
{
resources.AppendFormat("\"{0}\",\"{1}\"\n", p.Name, p.GetValue(null));
}
resources.AppendLine();
}
return resources.ToString();
}
}
Add this code to the project which contains your.resx files (mine are in a separate "Languages" project) then use the following code to save the result into a .csv so that it can be loaded with a spreadsheet editor.
var hack = new Languages.Export();
var resourcesSummary = hack.Run();
var cultureName = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
using (TextWriter file = File.CreateText(#"C:\resources." + cultureName + ".csv"))
{
file.Write(resourcesSummary);
}
This does not allow you to import files from the .csv back to your .resx files so that they can be compiled. It would be nice to have a utility that would do that.
You can use Simple Resx Editor, it has some interesting features that will help you into the translation process.
Even though it is counter intuitive, it's a better idea to translate the exe rather than the resource file. Read why here:
http://www.apptranslator.com/misconceptions.html
You may want to have a look at Excel Resource Transfer. It is
an Add-In for Microsoft Excel to import and export texts from resource files.
There is a trial version. The full version costs 25,- Euro.
If you're doing this for a web project, a better way to do internationalization (including translation) is to use the i18n nuget package. Not only does work better with templates but it has other nice-to-haves like localized URLs.
Here's an example from the github repo:
<div id="content">
<h2>[[[Welcome to my web app!]]]</h2>
<h3><span>[[[Amazing slogan here]]]</span></h3>
<p>[[[Ad copy that would make Hiten Shah fall off his chair!]]]</p>
<span class="button" title="[[[Click to see plans and pricing]]]">
<a href="#Url.Action("Plans", "Home", new { area = "" })">
<strong>[[[SEE PLANS & PRICING]]]</strong>
<span>[[[Free unicorn with all plans!]]]</span>
</a>
</span>
</div>
Running a post-build task generates a PO database that can be provided to translators that use PO editing tools (like POEdit) to provide locale-specific text.
You could use winres.exe from Microsoft, it lets you localize windows forms without having to use Visual Studio. It doesn't save the resources to a text file, but the idea is that the localization expert for each culture could use the tool to generate a localized versions of the application.
Here's a better explanation:
http://msdn.microsoft.com/en-us/library/8bxdx003(VS.80).aspx