Adding DeviceScreeenInfo
This commit is contained in:
@@ -5,7 +5,7 @@ using Navigator.Services;
|
|||||||
using Navigator.Views;
|
using Navigator.Views;
|
||||||
using MarketData.Service;
|
using MarketData.Service;
|
||||||
using Navigator.Utils;
|
using Navigator.Utils;
|
||||||
|
/*
|
||||||
namespace Navigator
|
namespace Navigator
|
||||||
{
|
{
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
@@ -15,6 +15,7 @@ namespace Navigator
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
DependencyService.Register<MockDataStore>();
|
DependencyService.Register<MockDataStore>();
|
||||||
|
DependencyService.Register<DeviceScreenInfo>();
|
||||||
if(!DesignMode.IsDesignModeEnabled)
|
if(!DesignMode.IsDesignModeEnabled)
|
||||||
{
|
{
|
||||||
if(MarketDataServiceClient.IsWiFiNetwork())MarketDataServiceClient.GetInstance().SetUrl(AppSettingsManager.Settings["Service_Local"],AppSettingsManager.Settings["ServiceUser"]);
|
if(MarketDataServiceClient.IsWiFiNetwork())MarketDataServiceClient.GetInstance().SetUrl(AppSettingsManager.Settings["Service_Local"],AppSettingsManager.Settings["ServiceUser"]);
|
||||||
@@ -36,3 +37,4 @@ namespace Navigator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Xamarin.Forms;
|
|||||||
using Xamarin.Forms.Platform.Android;
|
using Xamarin.Forms.Platform.Android;
|
||||||
using Navigator.Droid;
|
using Navigator.Droid;
|
||||||
using Android.Views.InputMethods;
|
using Android.Views.InputMethods;
|
||||||
|
using Android.Util;
|
||||||
|
|
||||||
[assembly: ExportRenderer(typeof(EntryWithCustomKeyboardReturnButton), typeof(EntryWithCustomKeyboardReturnButtonCustomRenderer))]
|
[assembly: ExportRenderer(typeof(EntryWithCustomKeyboardReturnButton), typeof(EntryWithCustomKeyboardReturnButtonCustomRenderer))]
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ namespace Navigator.Droid
|
|||||||
{
|
{
|
||||||
base.OnElementChanged(e);
|
base.OnElementChanged(e);
|
||||||
|
|
||||||
var customEntry = Element as EntryWithCustomKeyboardReturnButton;
|
var customEntry = Element as EntryWithCustomKeyboardReturnButton;
|
||||||
|
|
||||||
if (Control != null && customEntry != null)
|
if (Control != null && customEntry != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
|
using Android.App;
|
||||||
using Android.App;
|
|
||||||
using Android.Content.PM;
|
using Android.Content.PM;
|
||||||
using Android.Runtime;
|
using Android.Runtime;
|
||||||
using Android.OS;
|
using Android.OS;
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ namespace Navigator
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
DependencyService.Register<MockDataStore>();
|
DependencyService.Register<MockDataStore>();
|
||||||
|
DependencyService.Register<DeviceScreenInfo>();
|
||||||
|
|
||||||
InitializeConnection();
|
InitializeConnection();
|
||||||
|
|
||||||
MainPage = new MainPage();
|
MainPage = new MainPage();
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ namespace Navigator.Core
|
|||||||
{
|
{
|
||||||
public IDataStore<Item> DataStore => DependencyService.Get<IDataStore<Item>>();
|
public IDataStore<Item> DataStore => DependencyService.Get<IDataStore<Item>>();
|
||||||
|
|
||||||
|
public IDeviceScreenInfo DeviceScreenInfo => DependencyService.Get<IDeviceScreenInfo>();
|
||||||
|
|
||||||
bool isBusy = false;
|
bool isBusy = false;
|
||||||
public bool IsBusy
|
public bool IsBusy
|
||||||
{
|
{
|
||||||
@@ -20,12 +22,37 @@ namespace Navigator.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
string title = string.Empty;
|
string title = string.Empty;
|
||||||
|
|
||||||
public string Title
|
public string Title
|
||||||
{
|
{
|
||||||
get { return title; }
|
get { return title; }
|
||||||
set { SetProperty(ref title, value); }
|
set { SetProperty(ref title, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsDeviceTablet
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return DeviceScreenInfo.IsDeviceTablet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double ScreenWidth
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return DeviceScreenInfo.GetScreenDimensions().Width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double ScreenHeight
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return DeviceScreenInfo.GetScreenDimensions().Height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected bool SetProperty<T>(ref T backingStore, T value,[CallerMemberName] string propertyName = "",Action onChanged = null)
|
protected bool SetProperty<T>(ref T backingStore, T value,[CallerMemberName] string propertyName = "",Action onChanged = null)
|
||||||
{
|
{
|
||||||
if (EqualityComparer<T>.Default.Equals(backingStore, value))return false;
|
if (EqualityComparer<T>.Default.Equals(backingStore, value))return false;
|
||||||
@@ -36,6 +63,7 @@ namespace Navigator.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
|
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
|
||||||
{
|
{
|
||||||
var changed = PropertyChanged;
|
var changed = PropertyChanged;
|
||||||
|
|||||||
17
Navigator/Services/DeviceScreenInfo/DeviceScreenInfo.cs
Normal file
17
Navigator/Services/DeviceScreenInfo/DeviceScreenInfo.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using Xamarin.Essentials;
|
||||||
|
|
||||||
|
namespace Navigator.Services
|
||||||
|
{
|
||||||
|
public class DeviceScreenInfo : IDeviceScreenInfo
|
||||||
|
{
|
||||||
|
public (double Width, double Height) GetScreenDimensions()
|
||||||
|
{
|
||||||
|
return (DeviceDisplay.MainDisplayInfo.Width, DeviceDisplay.MainDisplayInfo.Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsDeviceTablet()
|
||||||
|
{
|
||||||
|
return DeviceInfo.Idiom.Equals(DeviceIdiom.Tablet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Navigator/Services/DeviceScreenInfo/IDeviceScreenInfo.cs
Normal file
11
Navigator/Services/DeviceScreenInfo/IDeviceScreenInfo.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
namespace Navigator.Services
|
||||||
|
{
|
||||||
|
public interface IDeviceScreenInfo
|
||||||
|
{
|
||||||
|
(double Width, double Height) GetScreenDimensions();
|
||||||
|
|
||||||
|
bool IsDeviceTablet();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,11 +4,8 @@ using System.IO.Compression;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Win32;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Navigator.MarketDataModel;
|
using Navigator.MarketDataModel;
|
||||||
//using MarketData.MarketDataModel;
|
|
||||||
|
|
||||||
namespace Navigator.Utils
|
namespace Navigator.Utils
|
||||||
{
|
{
|
||||||
@@ -29,6 +26,7 @@ namespace Navigator.Utils
|
|||||||
}
|
}
|
||||||
return sb.ToString() + str;
|
return sb.ToString() + str;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String RemoveHtml(String strItem)
|
public static String RemoveHtml(String strItem)
|
||||||
{
|
{
|
||||||
String[] codes = { "'","»" };
|
String[] codes = { "'","»" };
|
||||||
@@ -39,6 +37,7 @@ namespace Navigator.Utils
|
|||||||
}
|
}
|
||||||
return strItem;
|
return strItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String RemoveDivs(String strItem)
|
public static String RemoveDivs(String strItem)
|
||||||
{
|
{
|
||||||
StringBuilder sb=new StringBuilder();
|
StringBuilder sb=new StringBuilder();
|
||||||
@@ -53,6 +52,7 @@ namespace Navigator.Utils
|
|||||||
}
|
}
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String BetweenString(String strItem, String strBegin, String strEnd)
|
public static String BetweenString(String strItem, String strBegin, String strEnd)
|
||||||
{
|
{
|
||||||
if (null == strItem) return null;
|
if (null == strItem) return null;
|
||||||
@@ -74,6 +74,7 @@ namespace Navigator.Utils
|
|||||||
}
|
}
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String RemoveAfter(String strItem, char charItem)
|
public static String RemoveAfter(String strItem, char charItem)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -85,10 +86,12 @@ namespace Navigator.Utils
|
|||||||
}
|
}
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool OutOfRange(double value)
|
public static bool OutOfRange(double value)
|
||||||
{
|
{
|
||||||
return value > 100000000000000000000.00 || value< -99999999999999999999.99;
|
return value > 100000000000000000000.00 || value< -99999999999999999999.99;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String RemoveControlChars(String strItem)
|
public static String RemoveControlChars(String strItem)
|
||||||
{
|
{
|
||||||
StringBuilder sb=new StringBuilder();
|
StringBuilder sb=new StringBuilder();
|
||||||
@@ -99,6 +102,7 @@ namespace Navigator.Utils
|
|||||||
}
|
}
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String GetPath(String strPathFileName)
|
public static String GetPath(String strPathFileName)
|
||||||
{
|
{
|
||||||
int index=strPathFileName.LastIndexOf('\\');
|
int index=strPathFileName.LastIndexOf('\\');
|
||||||
@@ -106,18 +110,21 @@ namespace Navigator.Utils
|
|||||||
String strPath = strPathFileName.Substring(0, index);
|
String strPath = strPathFileName.Substring(0, index);
|
||||||
return strPath;
|
return strPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String KeepBefore(String strItem,String strKeepBefore)
|
public static String KeepBefore(String strItem,String strKeepBefore)
|
||||||
{
|
{
|
||||||
int startPos=strItem.IndexOf(strKeepBefore);
|
int startPos=strItem.IndexOf(strKeepBefore);
|
||||||
if(-1==startPos)return null;
|
if(-1==startPos)return null;
|
||||||
return strItem.Substring(0,startPos);
|
return strItem.Substring(0,startPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String KeepAfter(String strItem,String strKeepAfter)
|
public static String KeepAfter(String strItem,String strKeepAfter)
|
||||||
{
|
{
|
||||||
int startPos=strItem.IndexOf(strKeepAfter);
|
int startPos=strItem.IndexOf(strKeepAfter);
|
||||||
if(-1==startPos)return null;
|
if(-1==startPos)return null;
|
||||||
return strItem.Substring(startPos+strKeepAfter.Length);
|
return strItem.Substring(startPos+strKeepAfter.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String KeepAfterLast(String strItem,String strKeepAfter)
|
public static String KeepAfterLast(String strItem,String strKeepAfter)
|
||||||
{
|
{
|
||||||
if(null==strItem)return null;
|
if(null==strItem)return null;
|
||||||
@@ -125,6 +132,7 @@ namespace Navigator.Utils
|
|||||||
if(-1==startPos)return null;
|
if(-1==startPos)return null;
|
||||||
return strItem.Substring(startPos+strKeepAfter.Length);
|
return strItem.Substring(startPos+strKeepAfter.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String Find(String strItem,String search,char delimeter)
|
public static String Find(String strItem,String search,char delimeter)
|
||||||
{
|
{
|
||||||
if(null==strItem)return null;
|
if(null==strItem)return null;
|
||||||
@@ -146,6 +154,7 @@ namespace Navigator.Utils
|
|||||||
if(!foundDelimeter)return null;
|
if(!foundDelimeter)return null;
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String FindFirst(String strItem,String search,char delimeter)
|
public static String FindFirst(String strItem,String search,char delimeter)
|
||||||
{
|
{
|
||||||
if(null==strItem)return null;
|
if(null==strItem)return null;
|
||||||
@@ -167,10 +176,12 @@ namespace Navigator.Utils
|
|||||||
if(!foundDelimeter)return null;
|
if(!foundDelimeter)return null;
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String AddQuotes(String item)
|
public static String AddQuotes(String item)
|
||||||
{
|
{
|
||||||
return "\"" + item + "\"";
|
return "\"" + item + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long DateToLong(DateTime date)
|
public static long DateToLong(DateTime date)
|
||||||
{
|
{
|
||||||
int year = date.Year;
|
int year = date.Year;
|
||||||
@@ -178,6 +189,7 @@ namespace Navigator.Utils
|
|||||||
int day = date.Day;
|
int day = date.Day;
|
||||||
return (year * 10000) + (month * 100) + day;
|
return (year * 10000) + (month * 100) + day;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DateTime LongToDate(long longDate)
|
public static DateTime LongToDate(long longDate)
|
||||||
{
|
{
|
||||||
int year = (int)(longDate / 10000);
|
int year = (int)(longDate / 10000);
|
||||||
@@ -185,41 +197,49 @@ namespace Navigator.Utils
|
|||||||
int day = (int)(longDate - ((int)(longDate / 100)) * 100);
|
int day = (int)(longDate - ((int)(longDate / 100)) * 100);
|
||||||
return new DateTime(year, month, day);
|
return new DateTime(year, month, day);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String DateTimeToStringHHMMSS(DateTime dateTime)
|
public static String DateTimeToStringHHMMSS(DateTime dateTime)
|
||||||
{
|
{
|
||||||
if (Utility.IsEpoch(dateTime)) return "";
|
if (Utility.IsEpoch(dateTime)) return "";
|
||||||
return dateTime.ToString("HH:mm:ss");
|
return dateTime.ToString("HH:mm:ss");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String DateTimeToStringMMSDDSYYYY(DateTime dateTime)
|
public static String DateTimeToStringMMSDDSYYYY(DateTime dateTime)
|
||||||
{
|
{
|
||||||
if (Utility.IsEpoch(dateTime)) return "";
|
if (Utility.IsEpoch(dateTime)) return "";
|
||||||
return dateTime.ToString("MM/dd/yyyy");
|
return dateTime.ToString("MM/dd/yyyy");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String DateTimeToStringMMSDDSYYYYHHMMSS(DateTime dateTime)
|
public static String DateTimeToStringMMSDDSYYYYHHMMSS(DateTime dateTime)
|
||||||
{
|
{
|
||||||
if (Utility.IsEpoch(dateTime)) return "";
|
if (Utility.IsEpoch(dateTime)) return "";
|
||||||
return dateTime.ToString("MM/dd/yyyy hh:mm:ss");
|
return dateTime.ToString("MM/dd/yyyy hh:mm:ss");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String DateTimeToStringMMHDDHYYYY(DateTime dateTime)
|
public static String DateTimeToStringMMHDDHYYYY(DateTime dateTime)
|
||||||
{
|
{
|
||||||
if (Utility.IsEpoch(dateTime)) return "";
|
if (Utility.IsEpoch(dateTime)) return "";
|
||||||
return dateTime.ToString("MM-dd-yyyy");
|
return dateTime.ToString("MM-dd-yyyy");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String DateTimeToStringYYYYHMMHDD(DateTime dateTime)
|
public static String DateTimeToStringYYYYHMMHDD(DateTime dateTime)
|
||||||
{
|
{
|
||||||
if (Utility.IsEpoch(dateTime)) return "";
|
if (Utility.IsEpoch(dateTime)) return "";
|
||||||
return dateTime.ToString("yyyy-MM-dd");
|
return dateTime.ToString("yyyy-MM-dd");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String DateTimeToStringYYYYHMMHDDHHMMSS(DateTime dateTime)
|
public static String DateTimeToStringYYYYHMMHDDHHMMSS(DateTime dateTime)
|
||||||
{
|
{
|
||||||
if (Utility.IsEpoch(dateTime)) return "";
|
if (Utility.IsEpoch(dateTime)) return "";
|
||||||
return dateTime.ToString("yyyy-MM-dd HH:MM:ss");
|
return dateTime.ToString("yyyy-MM-dd HH:MM:ss");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String DateTimeToStringYYYYMMDD(DateTime dateTime)
|
public static String DateTimeToStringYYYYMMDD(DateTime dateTime)
|
||||||
{
|
{
|
||||||
if (Utility.IsEpoch(dateTime)) return "";
|
if (Utility.IsEpoch(dateTime)) return "";
|
||||||
return dateTime.ToString("yyyyMMdd");
|
return dateTime.ToString("yyyyMMdd");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String AsteriskForString(String str)
|
public static String AsteriskForString(String str)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -227,6 +247,7 @@ namespace Navigator.Utils
|
|||||||
for (int index = 0; index < length; index++) sb.Append("*");
|
for (int index = 0; index < length; index++) sb.Append("*");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String FormatNumber(double number)
|
public static String FormatNumber(double number)
|
||||||
{
|
{
|
||||||
StringBuilder sb=new StringBuilder();
|
StringBuilder sb=new StringBuilder();
|
||||||
@@ -234,6 +255,7 @@ namespace Navigator.Utils
|
|||||||
else sb.Append(String.Format("{0:0.000}", number));
|
else sb.Append(String.Format("{0:0.000}", number));
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String FormatNumber(double number,int places,bool commas=false)
|
public static String FormatNumber(double number,int places,bool commas=false)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -247,6 +269,7 @@ namespace Navigator.Utils
|
|||||||
else sb.Append(String.Format(formatString.ToString(), number));
|
else sb.Append(String.Format(formatString.ToString(), number));
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String FormatCurrency(double number)
|
public static String FormatCurrency(double number)
|
||||||
{
|
{
|
||||||
StringBuilder sb=new StringBuilder();
|
StringBuilder sb=new StringBuilder();
|
||||||
@@ -254,6 +277,7 @@ namespace Navigator.Utils
|
|||||||
else sb.Append(String.Format("{0:C}", number));
|
else sb.Append(String.Format("{0:C}", number));
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String FormatCurrency(double number,int decimals)
|
public static String FormatCurrency(double number,int decimals)
|
||||||
{
|
{
|
||||||
StringBuilder sb=new StringBuilder();
|
StringBuilder sb=new StringBuilder();
|
||||||
@@ -262,6 +286,7 @@ namespace Navigator.Utils
|
|||||||
else sb.Append(String.Format(currencyFormat, number));
|
else sb.Append(String.Format(currencyFormat, number));
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String FormatPercent(double number)
|
public static String FormatPercent(double number)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -269,12 +294,14 @@ namespace Navigator.Utils
|
|||||||
else sb.Append(String.Format("{0:P}", number));
|
else sb.Append(String.Format("{0:P}", number));
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String ConformDate(String strDate)
|
public static String ConformDate(String strDate)
|
||||||
{
|
{
|
||||||
String[] elements=strDate.Split(' ');
|
String[] elements=strDate.Split(' ');
|
||||||
if(elements.Length<3)return strDate;
|
if(elements.Length<3)return strDate;
|
||||||
return elements[0]+" "+elements[1]+" "+elements[2];
|
return elements[0]+" "+elements[1]+" "+elements[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DateTime ParseDate(String strDate)
|
public static DateTime ParseDate(String strDate)
|
||||||
{
|
{
|
||||||
System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("en-US");
|
System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("en-US");
|
||||||
@@ -283,6 +310,7 @@ namespace Navigator.Utils
|
|||||||
DateTime dateTime=DateTime.ParseExact(strDate, formats, new System.Globalization.CultureInfo("en-US"), DateTimeStyles.AssumeLocal);
|
DateTime dateTime=DateTime.ParseExact(strDate, formats, new System.Globalization.CultureInfo("en-US"), DateTimeStyles.AssumeLocal);
|
||||||
return dateTime;
|
return dateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double ParsePercent(String strPercent)
|
public static double ParsePercent(String strPercent)
|
||||||
{
|
{
|
||||||
if (null == strPercent) return double.NaN;
|
if (null == strPercent) return double.NaN;
|
||||||
@@ -290,6 +318,7 @@ namespace Navigator.Utils
|
|||||||
try { return double.Parse(strPercent)/100.00; }
|
try { return double.Parse(strPercent)/100.00; }
|
||||||
catch (Exception) { return double.NaN; }
|
catch (Exception) { return double.NaN; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double ParseCurrency(String strNumber)
|
public static double ParseCurrency(String strNumber)
|
||||||
{
|
{
|
||||||
if (null == strNumber) return double.NaN;
|
if (null == strNumber) return double.NaN;
|
||||||
@@ -302,10 +331,12 @@ namespace Navigator.Utils
|
|||||||
try { return double.Parse(strNumber); }
|
try { return double.Parse(strNumber); }
|
||||||
catch (Exception) { return double.NaN; }
|
catch (Exception) { return double.NaN; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String FormatCurrencyWithQuotes(double number)
|
public static String FormatCurrencyWithQuotes(double number)
|
||||||
{
|
{
|
||||||
return AddQuotes(FormatCurrency(number));
|
return AddQuotes(FormatCurrency(number));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String FormatDates(DateTime d1, DateTime d2)
|
public static String FormatDates(DateTime d1, DateTime d2)
|
||||||
{
|
{
|
||||||
StringBuilder sb=new StringBuilder();
|
StringBuilder sb=new StringBuilder();
|
||||||
@@ -313,6 +344,7 @@ namespace Navigator.Utils
|
|||||||
sb.Append(Utility.DateTimeToStringMMSDDSYYYY(d2));
|
sb.Append(Utility.DateTimeToStringMMSDDSYYYY(d2));
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String TrimToSpace(String strString)
|
public static String TrimToSpace(String strString)
|
||||||
{
|
{
|
||||||
if (null == strString) return strString;
|
if (null == strString) return strString;
|
||||||
@@ -325,22 +357,27 @@ namespace Navigator.Utils
|
|||||||
}
|
}
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String BooleanToYesNoString(bool booleanValue)
|
public static String BooleanToYesNoString(bool booleanValue)
|
||||||
{
|
{
|
||||||
return booleanValue ? "Yes" : "No";
|
return booleanValue ? "Yes" : "No";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsEpoch(DateTime dateTime)
|
public static bool IsEpoch(DateTime dateTime)
|
||||||
{
|
{
|
||||||
return dateTime.Equals(epoch);
|
return dateTime.Equals(epoch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DateTime Epoch
|
public static DateTime Epoch
|
||||||
{
|
{
|
||||||
get { return epoch; }
|
get { return epoch; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TimeSpan OneDay
|
public static TimeSpan OneDay
|
||||||
{
|
{
|
||||||
get{return oneDay;}
|
get{return oneDay;}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String ListToString(List<String> list,char separator=',')
|
public static String ListToString(List<String> list,char separator=',')
|
||||||
{
|
{
|
||||||
StringBuilder sb=new StringBuilder();
|
StringBuilder sb=new StringBuilder();
|
||||||
@@ -352,12 +389,14 @@ namespace Navigator.Utils
|
|||||||
}
|
}
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> ToList(String items,char separator=',')
|
public static List<String> ToList(String items,char separator=',')
|
||||||
{
|
{
|
||||||
List<String> list = items.Split(separator).ToList<String>();
|
List<String> list = items.Split(separator).ToList<String>();
|
||||||
list=(from String s in list select s.Trim()).ToList<String>();
|
list=(from String s in list select s.Trim()).ToList<String>();
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String FromList(List<String> items,String postFix=",")
|
public static String FromList(List<String> items,String postFix=",")
|
||||||
{
|
{
|
||||||
StringBuilder sb=new StringBuilder();
|
StringBuilder sb=new StringBuilder();
|
||||||
@@ -368,6 +407,7 @@ namespace Navigator.Utils
|
|||||||
}
|
}
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] Compress(String strString)
|
public static byte[] Compress(String strString)
|
||||||
{
|
{
|
||||||
MemoryStream outputStream = null;
|
MemoryStream outputStream = null;
|
||||||
@@ -387,7 +427,6 @@ namespace Navigator.Utils
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
// MDTrace.WriteLine(LogLevel.DEBUG,exception);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -404,6 +443,7 @@ namespace Navigator.Utils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String Decompress(byte[] compressedBytes)
|
public static String Decompress(byte[] compressedBytes)
|
||||||
{
|
{
|
||||||
MemoryStream compressedStream = new MemoryStream(compressedBytes);
|
MemoryStream compressedStream = new MemoryStream(compressedBytes);
|
||||||
@@ -430,7 +470,6 @@ namespace Navigator.Utils
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
// MDTrace.WriteLine(LogLevel.DEBUG,exception);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -452,28 +491,29 @@ namespace Navigator.Utils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//public static void LaunchBrowserSearch(String searchTerm)
|
|
||||||
//{
|
|
||||||
// Process.Start("https://www.google.com/search?q="+Uri.EscapeDataString(searchTerm)+"/");
|
|
||||||
//}
|
|
||||||
public static bool IsZeroOrNaN(double value)
|
public static bool IsZeroOrNaN(double value)
|
||||||
{
|
{
|
||||||
return IsNaN(value)||IsZero(value);
|
return IsNaN(value)||IsZero(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsZero(double value)
|
private static bool IsZero(double value)
|
||||||
{
|
{
|
||||||
if(value==0.00)return true;
|
if(value==0.00)return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsNaN(double value)
|
private static bool IsNaN(double value)
|
||||||
{
|
{
|
||||||
return double.IsNaN(value);
|
return double.IsNaN(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DeleteFile(String pathFileName)
|
public static void DeleteFile(String pathFileName)
|
||||||
{
|
{
|
||||||
if(!File.Exists(pathFileName))return;
|
if(!File.Exists(pathFileName))return;
|
||||||
try{File.Delete(pathFileName);}catch(Exception){;}
|
try{File.Delete(pathFileName);}catch(Exception){;}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static DateTime GetRunDate(String strPathFileName)
|
private static DateTime GetRunDate(String strPathFileName)
|
||||||
{
|
{
|
||||||
DateTime runDate=DateTime.Now.Date;
|
DateTime runDate=DateTime.Now.Date;
|
||||||
@@ -512,7 +552,6 @@ namespace Navigator.Utils
|
|||||||
}
|
}
|
||||||
catch(Exception)
|
catch(Exception)
|
||||||
{
|
{
|
||||||
// MDTrace.WriteLine(LogLevel.DEBUG,String.Format("GetRunDate:{0}",exception.ToString()));
|
|
||||||
return runDate;
|
return runDate;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using MarketData.Service;
|
|||||||
using Navigator.Core;
|
using Navigator.Core;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using Navigator.Utils;
|
using Navigator.Utils;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace Navigator.ViewModels
|
namespace Navigator.ViewModels
|
||||||
{
|
{
|
||||||
@@ -105,6 +106,21 @@ namespace Navigator.ViewModels
|
|||||||
set{SetProperty(ref status,value);}
|
set{SetProperty(ref status,value);}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String ScreenDimensions
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.Append("Device (");
|
||||||
|
sb.Append(Utility.FormatNumber(ScreenWidth,0));
|
||||||
|
sb.Append("x");
|
||||||
|
sb.Append(Utility.FormatNumber(ScreenHeight,0));
|
||||||
|
sb.Append(")");
|
||||||
|
sb.Append(IsDeviceTablet?"Tablet":"Phone");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String IPAddress
|
public String IPAddress
|
||||||
{
|
{
|
||||||
get{return ipAddress;}
|
get{return ipAddress;}
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ namespace Navigator.ViewModels
|
|||||||
ServiceResult serviceResult=null;
|
ServiceResult serviceResult=null;
|
||||||
IsBusy=true;
|
IsBusy=true;
|
||||||
ShowActivity=!IsRefreshing;
|
ShowActivity=!IsRefreshing;
|
||||||
|
|
||||||
Task workerTask=Task.Factory.StartNew(()=>
|
Task workerTask=Task.Factory.StartNew(()=>
|
||||||
{
|
{
|
||||||
StopLimit stopLimit=null;
|
StopLimit stopLimit=null;
|
||||||
@@ -136,6 +137,7 @@ namespace Navigator.ViewModels
|
|||||||
}
|
}
|
||||||
ChartTitle=sb.ToString();
|
ChartTitle=sb.ToString();
|
||||||
}
|
}
|
||||||
|
bollingerBandRenderer.DeviceIsTablet=DeviceScreenInfo.IsDeviceTablet();
|
||||||
bollingerBandRenderer.PortfolioTradesWithParityPrice=portfolioTradesWithParityPrice;
|
bollingerBandRenderer.PortfolioTradesWithParityPrice=portfolioTradesWithParityPrice;
|
||||||
bollingerBandRenderer.K=BollingerBandModel.K(bollingerBands);
|
bollingerBandRenderer.K=BollingerBandModel.K(bollingerBands);
|
||||||
bollingerBandRenderer.KL1=BollingerBandModel.KL1(bollingerBands);
|
bollingerBandRenderer.KL1=BollingerBandModel.KL1(bollingerBands);
|
||||||
@@ -209,7 +211,6 @@ namespace Navigator.ViewModels
|
|||||||
refreshCommand=new RelayCommand(param=>
|
refreshCommand=new RelayCommand(param=>
|
||||||
{
|
{
|
||||||
HandleBollingerBandRequest();
|
HandleBollingerBandRequest();
|
||||||
// IsRefreshing=false;
|
|
||||||
},param=>{return !IsRefreshing;});
|
},param=>{return !IsRefreshing;});
|
||||||
}
|
}
|
||||||
return refreshCommand;
|
return refreshCommand;
|
||||||
|
|||||||
@@ -73,6 +73,7 @@
|
|||||||
</Button.Behaviors>
|
</Button.Behaviors>
|
||||||
</Button>
|
</Button>
|
||||||
<Label Text="{Binding Status,Mode=TwoWay}" />
|
<Label Text="{Binding Status,Mode=TwoWay}" />
|
||||||
|
<Label Text="{Binding ScreenDimensions, Mode=OneWay}"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
Reference in New Issue
Block a user