public void UpdateMessage(MessageViewModel message) { _message = message; var call = message.Content as MessageCall; if (call == null || !_templateApplied) { return; } var outgoing = message.IsOutgoing; var missed = call.DiscardReason is CallDiscardReasonMissed or CallDiscardReasonDeclined; Button.Glyph = call.IsVideo ? Icons.Video : Icons.Phone; //Button.FontSize = call.IsVideo ? 24 : 20; TitleLabel.Text = call.ToOutcomeText(message.IsOutgoing); ReasonGlyph.Text = outgoing ? "\uE60B\u00A0" : "\uE60C\u00A0"; DateLabel.Text = Converter.Date(message.Date); if (call.Duration > 0 && !missed) { DurationLabel.Text = ", " + Locale.FormatCallDuration(call.Duration); } else { DurationLabel.Text = string.Empty; } VisualStateManager.GoToState(this, missed ? "Missed" : "Default", false); }
public void UpdateMessage(MessageViewModel message) { _message = message; var call = message.Content as MessageCall; if (call == null) { return; } var outgoing = message.IsOutgoing; var missed = call.DiscardReason is CallDiscardReasonMissed || call.DiscardReason is CallDiscardReasonDeclined; TitleLabel.Text = missed ? (outgoing ? Strings.Resources.CallMessageOutgoingMissed : Strings.Resources.CallMessageIncomingMissed) : (outgoing ? Strings.Resources.CallMessageOutgoing : Strings.Resources.CallMessageIncoming); ReasonGlyph.Text = outgoing ? "\uE60B\u00A0" : "\uE60C\u00A0"; DateLabel.Text = BindConvert.Current.Date(message.Date); if (call.Duration > 0 && !missed) { DurationLabel.Text = ", " + Locale.FormatCallDuration(call.Duration); } else { DurationLabel.Text = string.Empty; } VisualStateManager.GoToState(this, missed ? "Missed" : "Default", false); }
private string GetDisplayType() { if (IsFailed) { return(Strings.Resources.CallMessageIncomingMissed); } var finalType = string.Empty; var types = new List <TLCallDisplayType>(); foreach (var message in Items) { var call = message.Content as MessageCall; if (call == null) { continue; } var outgoing = message.IsOutgoing; var missed = call.DiscardReason is CallDiscardReasonMissed || call.DiscardReason is CallDiscardReasonDeclined; var type = missed ? (outgoing ? TLCallDisplayType.Cancelled : TLCallDisplayType.Missed) : (outgoing ? TLCallDisplayType.Outgoing : TLCallDisplayType.Incoming); if (types.Contains(type)) { } else { types.Add(type); } } if (types.Count > 1) { while (types.Contains(TLCallDisplayType.Cancelled)) { types.Remove(TLCallDisplayType.Cancelled); } } var typesArray = types.OrderBy(x => (int)x); foreach (var typeValue in typesArray) { var type = StringForDisplayType(typeValue); if (finalType.Length == 0) { finalType = type; } else { finalType += $", {type}"; } } if (Items.Count == 1) { var message = Items[0]; var call = message.Content as MessageCall; if (call == null) { return(string.Empty); } var missed = call.DiscardReason is CallDiscardReasonMissed || call.DiscardReason is CallDiscardReasonDeclined; var duration = missed || call.Duration < 1 ? null : Locale.FormatCallDuration(call.Duration); finalType = duration != null?string.Format("{0} ({1})", finalType, duration) : finalType; } return(finalType); }
private static String GetFloodWaitString(String error) { var time = error.ToInt32(); return(string.Format(Strings.Resources.FloodWaitTime, Locale.FormatCallDuration(time))); }