What is the Net Standard Library for Plugin.GoogleAnalytics - xamarin

What is the Net Standard Library for Plugin.GoogleAnalytics? I'm converting Portable Class Libraries to Net Standard ones, couldn't find the equivalent of this package.
Below is the IAnalytics interface for this library.
void SendEvent(string category, string action, string label, long value);
void SendEvent(string category, string action, string label, int value);
void SendEvent(string category, string action, string label);
void SendEvent(string category, string action);
void SendException(string description, bool isFatal);
void SendException(Exception exception, bool isFatal);
void SendView(string screenName);
void SetEndSession(bool value);
void SetStartSession(bool value);

Related

Numeric Filter - need it to accept decimal point?

I lifted a Numeric Filter from here,
but it isn't quite what I need, it will not allow the input of a single Decimal point,
This filter looks like this
DocumentFilter numericFilter = new DocumentFilter(){
#Override
public void insertString(DocumentFilter.FilterBypass fb, int offset,
String string, AttributeSet attr)
throws BadLocationException {
fb.insertString(offset, string.replaceAll("[^\\d]", ""), attr);
}
#Override
public void replace(DocumentFilter.FilterBypass fb, int offset, int length,
String text, AttributeSet attrs)
throws BadLocationException {
fb.replace(offset, length, text.replaceAll("[^\\d]", ""), attrs);
}
};
How can I alter this so it will allow the single inclusion of a decimal point?
thanks,
Phil

Align method parameters with VS or R#

I set some wrapping settings in Resharper but I can't figure out how to change this:
void Write(string Ludwig,
string Von,
string Mises)
{
}
to this:
void Write(string Ludwig,
string Von,
string Mises)
{
}

How can I programatically pin an item that displays a jump list to the start menu in WIN7

I want to add an item to the start menu to display a list of applications that the user can launch. Kind of like a custom menu. I got the WIN API code pack and understand that I can use a jump list for the popup menu part. Not sure how I can pin something to the start menu though. I'm looking for something along the lines of what IE displays.
Was able to accomplish this using Shell32 library.
public static class VerbNames{
public static string PinToStartMenu = "Pin to Start Men&u";
public static string UnpinFromStartMenu = "Unpin from Start Men&u";
public static string PinToTaskbar = "Pin to Tas&kbar";
public static string UnpinFromTaskbar = "Unpin from Tas&kbar";
}
public static class DesktopUtil {
public static void PinItemToStartMenu(string itemPath, string itemName) {
DoItemVerb(itemPath, itemName, VerbNames.PinToStartMenu);
}
public static void UnpinItemFromStartMenu(string itemPath, string itemName) {
DoItemVerb(itemPath, itemName, VerbNames.UnpinFromStartMenu);
}
public static void PinItemToTaskbar(string itemPath, string itemName) {
DoItemVerb(itemPath, itemName, VerbNames.PinToTaskbar);
}
public static void UnpinItemFromTaskbar(string itemPath, string itemName) {
DoItemVerb(itemPath, itemName, VerbNames.UnpinFromTaskbar);
}
private static void DoItemVerb(string itemPath, string itemName, string verb) {
Shell32.Shell shell = new Shell32.Shell();
Shell32.Folder folder = shell.NameSpace(itemPath);
Shell32.FolderItem item = folder.ParseName(itemName);
DoItemVerb(item, verb);
}
private static void DoItemVerb(Shell32.FolderItem item, string verbToDo) {
Shell32.FolderItemVerbs verbs = item.Verbs();
foreach (Shell32.FolderItemVerb verb in verbs) {
if (verb.Name.Equals(verbToDo)) {
verb.DoIt();
}
}
}
}

Could i extension the ModelStateDictionary Class in MVC3

in the ModelStateDictionary class there are only AddModelError and Add function , i want extention the class, add the method like AddModeSuccess,AddModelWarning.
i have a look at the MVC3 source code and found there a lot of thing need add. i don't want to modify the MVC3 code, i just want to add a extention. how could i do?
public void Add(KeyValuePair<string, ModelState> item) {
((IDictionary<string, ModelState>)_innerDictionary).Add(item);
}
public void Add(string key, ModelState value) {
_innerDictionary.Add(key, value);
}
public void AddModelError(string key, Exception exception) {
GetModelStateForKey(key).Errors.Add(exception);
}
public void AddModelError(string key, string errorMessage) {
GetModelStateForKey(key).Errors.Add(errorMessage);
}
You could add them as extension methods to the ModelStateDictionary class:
public static class ModelStateExtensions
{
public static void AddModelSuccess(this ModelStateDictionary modelState, ... some parameters)
{
...
}
public static void AddModelWarning(this ModelStateDictionary modelState, ... some parameters)
{
...
}
}

Using a Delegate with Messages

I'm learning about delegates and think I may have found a use for one. Basically what I have is a series of string properties that take in a minimum value and a maximum value, like so:
string weightInvalid(min as int32, max as int32)
There are several messages like this, all with unique messages but all sharing the same signature of minimum and maximum. I think that a delegate could be used here, but how would I go about doing so? It would really help me to see some code so I could get a grasp on this delegate stuff.
Below is a simple Console application example that may help...
public delegate string foo(int min, int max);
class Program
{
static void Main(string[] args)
{
CallFoo(foo1);
CallFoo(foo2);
CallFoo(foo3);
Console.WriteLine("Press ENTER to exit...");
Console.ReadLine();
}
private static void CallFoo(foo foo)
{
Console.WriteLine(foo(1, 2));
}
private static string foo1(int min, int max)
{
return "foo1";
}
private static string foo2(int min, int max)
{
return "foo2";
}
private static string foo3(int min, int max)
{
return "foo3";
}
on c#:
delegate string weightInvalid(int min, int max);
string MyWeightInvalid(int min, int max)
{
return "";
}
string SomeMethod()
{
weightInvalid myFunc = new weightInvalid(MyWeightInvalid);
return myFunc(0, 1);
}

Resources