How to visualize FlatIcon fonticon in xamarin ios native project? - ios

There is a problem about usage of Flaticon. I have imported .ttf file that I have downloaded and I have visual of FontIcon font style in my project. Here is a example code of implementation flaticon fonts.
public static class FlatIcon
{
public static string FlaticonTwitterLogoSilhoutte = "\f100";
public static string FlaticonGooglePlus = "\f101";
public static string FlaticonFacebookLogo = "\f102";
public static string FlaticonTick = "\f103";
}
And here is the code that I am trying to visualize Icon.
FacebookIcon.Text = $"{FlatIcon.FlaticonFacebookLogo}";
I am not able to get output of what I expect and I am not able to understand why, can you help me with this issue?

Related

Can anyone help me to get a value from .XML

I've executed my code in selenium-java and i need a value of Identifiers(2nd line, not the 4th one) from .XML which is opened in MS edge browser.
My XML:
<Application Type="ABCD">
<Identifier>18753</Identifier>
<SalesChannel SalesChannelType="PQRS" SalesChannelSegment="XYZ">
<Identifier>AB1234</Identifier>
Can anyone help me with the code to get a values(18753) which is between Identifier 2nd line.
Note: I've a code which is working fine for chrome & FF, but bot able to work for MSedge:
Assert.assertTrue(driver.getPageSource().contains("Identifier"));
String xml = driver.getPageSource();
String appID = xml.split("<Identifier>")[0].split("</Identifier>")[1];
I think there's a mistake in your split function. The right code should be like this:
String appID = xml.split("</Identifier>")[0].split("<Identifier>")[1];
Sample code:
import org.junit.Assert;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.edge.EdgeOptions;
public class Edgeauto {
public static void main(String[] args) {
System.setProperty("webdriver.edge.driver", "your_path_of_webdriver\\msedgedriver.exe");
EdgeOptions edgeOptions = new EdgeOptions();
WebDriver driver = new EdgeDriver(edgeOptions);
driver.get("http://xxx.xml");
Assert.assertTrue(driver.getPageSource().contains("Identifier"));
String xml = driver.getPageSource();
String appID = xml.split("</Identifier>")[0].split("<Identifier>")[1];
System.out.println(appID);
}
}
Result:

ExecutionEngineException: Attempting to JIT compile method

public class StaticDataContainer<T> where T : IStaticData {
protected static Dictionary<int, T> data;
public static void init(string jsonString){
//It work fine in Unity,But in Xcode iOS,it will show an error below:
//ExecutionEngineException: Attempting to JIT compile method
//'System.Collections.Generic.Dictionary`2<int, AD>:.ctor ()'
//while running with --aot-only.
data = new Dictionary<int, T> ();
I refer to:http://answers.unity3d.com/questions/250803/executionengineexception-attempting-to-jit-compile.html
Your application makes use of some generic type that was missed during AOT compile.
And solution is:The problem can usually be fixed by including a "dummy" class that references the missing types.
But I dont' know what dummy class is.
How can I solve it?
Here's how I do it. I create a file with name AOTDummy.cs in a project with following structure (adapted for your problem):
public static class AOTDummy
{
public static void Dummy()
{
System.Collections.Generic.Dictionary<int, AD> dummy01;
}
}

In Windows Phone 8, how to bind enum and listpicker

Can someone please give me an example how to bind enum to listpicker on Windows Phone 8?
Can't find any on the internet... and the lack of documentation regarding this toolkit won't help.
Thanks
Binding that is easy. The only problem is that the extension method GetNames() is not available in windows phone. However, you can write one.
public static class EnumExtensions {
public static IEnumerable<string> GetNames<TEnum>() where TEnum : struct {
var type = typeof(TEnum);
if (!type.IsEnum)
throw new ArgumentException(String.Format("Type '{0}' is not an enum", type.Name));
return (
from field in type.GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static)
where field.IsLiteral
select field.Name)
.ToList<string>();
}
}
Once you have that it is easy to bind it to any list.
public enum MyEnum {
v1, v2, v3
}
// Binding
myListPicker.ItemsSource = EnumExtensions.GetNames<MyEnum>();
// Getting selected value
var myEnum = (MyEnum)Enum.Parse(typeof(MyEnum), myListPicker.SelectedItem.ToString());

How to reference static classes in Actionscript

I apologize in advance for the newbiness of this question; I think I'm not grasping the basics of Actionscript but haven't been able to find an answer elsewhere.
What I want is some global constants like one would have in C++. In C++, I would simply have a file where I would #define MAP_HEIGHT 20, or something like that, and they would be globally accessible when I included the file at the top. In Actionscript, I've tried making a static class instead, like so:
package
{
public class Settings {
public const mapx:int = 20;
public function Settings() {}
}
}
But when I try to reference it in my code with colon syntax
var a:int = Settings::mapx;
I get the error "[Fault] exception, information=TypeError: Error #1034: Type Coercion failed: cannot convert Settings$ to Namespace."
I tried dot syntax:
var a:int = Settings.mapx;
and got a different error, "Access of possibly undefined property mapx through a reference with static type Class."
But what I really want is a file of global static variables, like in C++, and can't find a way to do it in Actionscript.
Mark variables, constants, and functions with the static keyword, as in:
package
{
public class MathUtil
{
public static const PI:Number = 3.141592653589;
public static function deg2rad(angle:Number):Number
{
angle = !isNaN(angle) ? (angle) : (0);
return angle * PI / 180;
}
}
}
Then you may use dot notation.
var pi:Number = MathUtil.PI;
var angle:Number = MathUtil.deg2rad(45);
From ActionScript 3.0 Reference for the Adobe Flash Platform: Statements, Keywords & Directives
Usage
class someClassName {
static var varName;
static const kName;
static function methodName() { }
}
You can use static in class definitions only, not in interface
definitions.
Static class members are not inherited. You cannot refer to a static
class member using the name of a subclass, as you can in Java or C++.
You can, however, refer to a static variable or method within a class
or subclass, without using any qualifier. See the example below.
You cannot use the super statement or the this keyword inside a static
method.

Microsoft.Xna.Framework.Content.ContentLoadException in MonoGame when calling string from a stored xnb file path

(I am using VS2012 Ultimate to make Windows Phone 8 Game with MonoGame)
So I have a class called ImagePathStorer.
The purpose of the class is to store the string path from my xnb background file so, instead of writing below code in my LoadContent method (in DrawableGameComponent):
_bg = Game.Content.Load<Texture2D>(#"Resources/Images/Backgrounds/Loading");
I can write this instead to make it cleaner, and easier to maintain:
_bg = Game.Content.Load<Texture2D>(images.getBackgroundsPath(BackgroundName.Loading));
Note :
_bg is a Texture2D object.
BackgroundName is an enum to store the name of Backgrounds in my project.
And this is the ImagePathStorer class :
public class ImagePathStorer
{
private List<string> backgroundsPath;
public ImagePathStorer()
{
InitBackgroundsPath();
}
private void InitBackgroundsPath()
{
backgroundsPath = new List<string>();
backgroundsPath.Insert((int)BackgroundName.Battle, #"Resources/Images/Backgrounds/Battle");
backgroundsPath.Insert((int)BackgroundName.Loading, #"Resources/Images/Backgrounds/Loading");
backgroundsPath.Insert((int)BackgroundName.Option, #"Resources/Images/Backgrounds/Option");
backgroundsPath.Insert((int)BackgroundName.Start, #"Resources/Images/Backgrounds/Start");
backgroundsPath.Insert((int)BackgroundName.Tutorial, #"Resources/Images/Backgrounds/Tutorial");
}
}
But when I compiled it, there is an error message from :
_bg = Game.Content.Load<Texture2D>(images.getBackgroundsPath(BackgroundName.Loading));
....which says : "ContentLoadException was unhandled by user code" "An exception of type 'Microsoft.Xna.Framework.Content.ContentLoadException' occured in MonoGame.Framework.DLL but was not handled in user code"
I've tried this one instead :
_bg = Game.Content.Load<Texture2D>("#"+images.getBackgroundsPath(BackgroundName.Loading));
but the results are no different. Any idea? Big thanks.

Resources