private SolidColorBrush ReturnBrush(Usage usage) { if (usage.IsSms || usage.IsMms) return (SolidColorBrush)Application.Current.Resources["SmsColorBrush"]; if (usage.IsData) return (SolidColorBrush)Application.Current.Resources["DataColorBrush"]; return (SolidColorBrush)Application.Current.Resources["VikingColorBrush"]; }
private BitmapImage ReturnImage(Usage usage) { if (usage.IsSuperOnNet) { var helmet = (Visibility.Visible == (Visibility) Application.Current.Resources["PhoneDarkThemeVisibility"]) ? "/Assets/helmetWhite.png":"/Assets/helmetBlack.png"; return new BitmapImage(new Uri(helmet, UriKind.Relative)); } return usage.IsIncoming ? new BitmapImage((new Uri((Visibility.Visible == (Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"]) ? "/Assets/download.png" : "/Assets/downloaddark.png", UriKind.Relative))) : new BitmapImage((new Uri((Visibility.Visible == (Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"]) ? "/Assets/upload.png" : "/Assets/uploaddark.png", UriKind.Relative))); }
private string GetType(Usage usage) { if (usage.IsMms) return AppResources.ConverterMMS.ToLower(); if (usage.IsSms) return AppResources.ConverterSMS.ToLower(); if (usage.IsVoice) return AppResources.ConverterCall.ToLower(); return usage.IsData ? AppResources.ConverterData : string.Empty; }
private string ReturnTimeSpan(Usage usage) { var timestamp = string.Empty; var difference = (System.Convert.ToDateTime(usage.EndTimestamp) - System.Convert.ToDateTime(usage.StartTimestamp)); if (difference.Days > 0) timestamp += string.Format(AppResources.ConverterDaysFormat, difference.Days).Space(); if (difference.Hours > 0) timestamp += string.Format(AppResources.ConverterHoursFormat, difference.Hours).Space(); if (difference.Minutes > 0) timestamp += string.Format(AppResources.ConverterMinutesFormat, difference.Minutes).Space(); if (difference.Seconds > 0) timestamp += string.Format(AppResources.ConverterSecondsFormat, difference.Seconds); return timestamp; }
private string ReturnInformation(Usage usage) { string information; if (usage.IsMms || usage.IsSms || usage.IsVoice) { var to = (usage.IsIncoming) ? AppResources.ConverterFrom:AppResources.ConverterTo; information = string.Format("{0} {1} {2} ", GetType(usage), to, FetchContactName(usage.To)); } else { information = string.Format(AppResources.ConverterDataFormat, (!usage.DurationHuman.Equals("n/a")) ? usage.DurationHuman : "0 " + AppResources.ConverterMB); } return information; }
private string ReturnInformation(Usage usage) { const string unit = "€"; var information = string.Empty; if (usage.IsVoice) { information += string.Format(AppResources.ConverterDurationFormat, ReturnTimeSpan(usage)); } var value = (usage.Price == "0.00") ? string.Empty : unit + usage.Price; if (string.IsNullOrEmpty(value)) return information; if (!string.IsNullOrEmpty(information)) information += Environment.NewLine; information += string.Format(AppResources.ConverterCostFormat, value); return information; }
private Visibility ReturnInformation(Usage usage) { if (usage.IsVoice) return Visibility.Visible; return (usage.Price == "0.00") ? Visibility.Collapsed: Visibility.Visible; }