Worked on VC directory and favorites. Fixed various bugs.

This commit is contained in:
Neil Dorin
2017-10-11 21:43:14 -06:00
parent 2def648596
commit fb0a91b454
16 changed files with 1895 additions and 1674 deletions

View File

@@ -5,6 +5,7 @@ using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec;
namespace PepperDash.Essentials.Devices.Common.Codec
@@ -54,16 +55,16 @@ namespace PepperDash.Essentials.Devices.Common.Codec
{
handler(this, new EventArgs());
if (Debug.Level == 1)
{
//if (Debug.Level == 1)
//{
Debug.Console(1, "RecentCalls:\n");
// Debug.Console(1, "RecentCalls:\n");
foreach (CodecCallHistory.CallHistoryEntry entry in RecentCalls)
{
Debug.Console(1, "\nName: {0}\nNumber: {1}\nStartTime: {2}\nType: {3}\n", entry.Name, entry.Number, entry.StartTime.ToString(), entry.OccurenceType);
}
}
// foreach (CodecCallHistory.CallHistoryEntry entry in RecentCalls)
// {
// Debug.Console(1, "\nName: {0}\nNumber: {1}\nStartTime: {2}\nType: {3}\n", entry.Name, entry.Number, entry.StartTime.ToString(), entry.OccurenceType);
// }
//}
}
}
@@ -94,6 +95,7 @@ namespace PepperDash.Essentials.Devices.Common.Codec
foreach (CiscoCallHistory.Entry entry in entries)
{
genericEntries.Add(new CallHistoryEntry()
{
Name = entry.DisplayName.Value,

View File

@@ -15,6 +15,8 @@ namespace PepperDash.Essentials.Devices.Common.Codec
CodecDirectory DirectoryRoot { get; }
CodecPhonebookSyncState PhonebookSyncState { get; }
void SearchDirectory(string searchString);
void GetDirectoryFolderContents(string folderId);
@@ -29,7 +31,7 @@ namespace PepperDash.Essentials.Devices.Common.Codec
{
public List<DirectoryItem> DirectoryResults { get; private set; }
//public int Offset { get; private set; }
public string ResultsFolderId { get; set; }
//public int Limit { get; private set; }

View File

@@ -132,8 +132,24 @@ namespace PepperDash.Essentials.Devices.Common.Codec
&& DateTime.Now <= EndTime.AddMinutes(-5);
}
}
public string ConferenceNumberToDial { get; set; }
//public string ConferenceNumberToDial { get; set; }
public string ConferencePassword { get; set; }
public bool IsOneButtonToPushMeeting { get; set; }
public List<Call> Calls { get; private set; }
public Meeting()
{
Calls = new List<Call>();
}
}
public class Call
{
public string Number { get; set; }
public string Protocol { get; set; }
public string CallRate { get; set; }
public string CallType { get; set; }
}
public class MeetingEventArgs : EventArgs

View File

@@ -136,8 +136,8 @@
<Compile Include="Streaming\Roku.cs" />
<Compile Include="VideoCodec\CiscoCodec\BookingsDataClasses.cs" />
<Compile Include="VideoCodec\CiscoCodec\CallHistoryDataClasses.cs" />
<Compile Include="VideoCodec\CiscoCodec\CiscoCodec.cs" />
<Compile Include="VideoCodec\CiscoCodec\CiscoCodecPropertiesConfig.cs" />
<Compile Include="VideoCodec\CiscoCodec\CiscoSparkCodec.cs" />
<Compile Include="VideoCodec\CiscoCodec\CiscoSparkCodecPropertiesConfig.cs" />
<Compile Include="VideoCodec\MockVC\MockVcPropertiesConfig.cs" />
<Compile Include="VideoCodec\CiscoCodec\PhonebookDataClasses.cs" />
<Compile Include="VideoCodec\CiscoCodec\xConfiguration.cs" />

View File

@@ -109,11 +109,11 @@ namespace PepperDash.Essentials.Devices.Common
.MockVC(key, name, props);
}
else if (typeName == "ciscocodec")
else if (typeName.StartsWith("ciscospark"))
{
var comm = CommFactory.CreateCommForDevice(dc);
var props = JsonConvert.DeserializeObject<Codec.CiscoCodecPropertiesConfig>(properties.ToString());
return new PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CiscoCodec(key, name, comm, props);
var props = JsonConvert.DeserializeObject<Codec.CiscoSparkCodecPropertiesConfig>(properties.ToString());
return new PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CiscoSparkCodec(key, name, comm, props);
}
else if (groupName == "settopbox") //(typeName == "irstbbase")

View File

@@ -189,8 +189,32 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
public string Value { get; set; }
}
public class Calls
public class Number
{
public string Value { get; set; }
}
public class Protocol
{
public string Value { get; set; }
}
public class CallRate
{
public string Value { get; set; }
}
public class CallType
{
public string Value { get; set; }
}
public class Call
{
public Number Number { get; set; }
public Protocol Protocol { get; set; }
public CallRate CallRate { get; set; }
public CallType CallType { get; set; }
}
public class ConnectMode
@@ -200,8 +224,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
public class DialInfo
{
public Calls Calls { get; set; }
public List<Call> Calls { get; set; }
public ConnectMode ConnectMode { get; set; }
public DialInfo()
{
Calls = new List<Call>();
}
}
public class Booking
@@ -231,6 +260,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
Title = new Title();
Agenda = new Agenda();
Privacy = new Privacy();
DialInfo = new DialInfo();
}
}
@@ -270,13 +300,36 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
var meeting = new Meeting();
meeting.Id = b.Id.Value;
meeting.Organizer = string.Format("{0}, {1}", b.Organizer.LastName.Value, b.Organizer.FirstName.Value);
meeting.Title = b.Title.Value;
meeting.Agenda = b.Agenda.Value;
meeting.StartTime = b.Time.StartTime.Value;
meeting.EndTime = b.Time.EndTime.Value;
meeting.Privacy = CodecCallPrivacy.ConvertToDirectionEnum(b.Privacy.Value);
if(b.Id != null)
meeting.Id = b.Id.Value;
if(b.Organizer != null)
meeting.Organizer = string.Format("{0}, {1}", b.Organizer.LastName.Value, b.Organizer.FirstName.Value);
if(b.Title != null)
meeting.Title = b.Title.Value;
if(b.Agenda != null)
meeting.Agenda = b.Agenda.Value;
if(b.Time != null)
meeting.StartTime = b.Time.StartTime.Value;
meeting.EndTime = b.Time.EndTime.Value;
if(b.Privacy != null)
meeting.Privacy = CodecCallPrivacy.ConvertToDirectionEnum(b.Privacy.Value);
#warning Update this ConnectMode conversion after testing onsite. Expected value is "OBTP", but in PD NYC Test scenarios, "Manual" is being returned for OBTP meetings
if (b.DialInfo.ConnectMode != null)
if (b.DialInfo.ConnectMode.Value.ToLower() == "obtp" || b.DialInfo.ConnectMode.Value.ToLower() == "manual")
meeting.IsOneButtonToPushMeeting = true;
foreach (Call c in b.DialInfo.Calls)
{
meeting.Calls.Add(new PepperDash.Essentials.Devices.Common.Codec.Call()
{
Number = c.Number.Value,
Protocol = c.Protocol.Value,
CallRate = c.CallRate.Value,
CallType = c.CallType.Value
});
}
meetings.Add(meeting);
@@ -284,7 +337,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
Debug.Console(1, "Title: {0}, ID: {1}, Organizer: {2}, Agenda: {3}", meeting.Title, meeting.Id, meeting.Organizer, meeting.Agenda);
Debug.Console(1, " Start Time: {0}, End Time: {1}, Duration: {2}", meeting.StartTime, meeting.EndTime, meeting.Duration);
Debug.Console(1, " Joinable: {0}", meeting.Joinable);
Debug.Console(1, " Joinable: {0}\n", meeting.Joinable);
}
}

View File

@@ -21,7 +21,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
enum eCommandType { SessionStart, SessionEnd, Command, GetStatus, GetConfiguration };
public class CiscoCodec : VideoCodecBase, IHasCallHistory, IHasCallFavorites, IHasDirectory,
public class CiscoSparkCodec : VideoCodecBase, IHasCallHistory, IHasCallFavorites, IHasDirectory,
IHasScheduleAwareness, IOccupancyStatusProvider, IHasCodecLayouts, IHasCodecSelfview
{
public event EventHandler<DirectoryEventArgs> DirectoryResultReturned;
@@ -188,7 +188,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
private CodecSyncState SyncState;
private CodecPhonebookSyncState PhonebookSyncState;
public CodecPhonebookSyncState PhonebookSyncState { get; private set; }
private StringBuilder JsonMessage;
@@ -214,7 +214,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public RoutingOutputPort HdmiOut { get; private set; }
// Constructor for IBasicCommunication
public CiscoCodec(string key, string name, IBasicCommunication comm, CiscoCodecPropertiesConfig props )
public CiscoSparkCodec(string key, string name, IBasicCommunication comm, CiscoSparkCodecPropertiesConfig props )
: base(key, name)
{
StandbyIsOnFeedback = new BoolFeedback(StandbyStateFeedbackFunc);
@@ -329,6 +329,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
prefix + "/Status/RoomAnalytics" + Delimiter +
prefix + "/Status/Standby" + Delimiter +
prefix + "/Status/Video/Selfview" + Delimiter +
prefix + "/Status/Video/Layout" + Delimiter +
prefix + "/Bookings" + Delimiter +
prefix + "/Event/CallDisconnect" + Delimiter;
@@ -675,8 +676,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
JsonConvert.PopulateObject(response, codecBookings);
CodecSchedule.Meetings = CiscoCodecBookings.GetGenericMeetingsFromBookingResult(codecBookings.CommandResponse.BookingsListResult.Booking);
if(codecBookings.CommandResponse.BookingsListResult.ResultInfo.TotalRows.Value != "0")
CodecSchedule.Meetings = CiscoCodecBookings.GetGenericMeetingsFromBookingResult(codecBookings.CommandResponse.BookingsListResult.Booking);
}
@@ -795,7 +796,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
/// <param name="folderId"></param>
public void GetDirectoryFolderContents(string folderId)
{
SendText(string.Format("xCommand Phonebook Search FolderId: {0} PhonebookType: {1} ContactType: Contact Limit: {2}", folderId, PhonebookMode, PhonebookResultsLimit));
SendText(string.Format("xCommand Phonebook Search FolderId: {0} PhonebookType: {1} ContactType: Any Limit: {2}", folderId, PhonebookMode, PhonebookResultsLimit));
}
void PrintPhonebook(CodecDirectory directory)
@@ -808,7 +809,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
if (item is DirectoryFolder)
{
Debug.Console(1, this, "+ {0}", item.Name);
Debug.Console(1, this, "[+] {0}", item.Name);
}
else if (item is DirectoryContact)
{
@@ -818,14 +819,38 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
}
}
public override void Dial(string s)
/// <summary>
/// Simple dial method
/// </summary>
/// <param name="number"></param>
public override void Dial(string number)
{
SendText(string.Format("xCommand Dial Number: \"{0}\"", s));
SendText(string.Format("xCommand Dial Number: \"{0}\"", number));
}
public void DialBookingId(string s)
/// <summary>
/// Dials a specific meeting
/// </summary>
/// <param name="meeting"></param>
public override void Dial(Meeting meeting)
{
SendText(string.Format("xCommand Dial BookingId: {0}", s));
foreach (Call c in meeting.Calls)
{
Dial(c.Number, c.Protocol, c.CallRate, c.CallType, meeting.Id);
}
}
/// <summary>
/// Detailed dial method
/// </summary>
/// <param name="number"></param>
/// <param name="protocol"></param>
/// <param name="callRate"></param>
/// <param name="callType"></param>
/// <param name="meetingId"></param>
public void Dial(string number, string protocol, string callRate, string callType, string meetingId)
{
SendText(string.Format("xCommand Dial Number: \"{0}\" Protocol: {1} CallRate: {2} CallType: {3} BookingId: {4}", number, protocol, callRate, callType, meetingId));
}
public override void EndCall(CodecActiveCallItem activeCall)
@@ -1259,98 +1284,4 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
}
}
/// <summary>
/// Used to track the status of syncronizing the phonebook values when connecting to a codec or refreshing the phonebook info
/// </summary>
public class CodecPhonebookSyncState : IKeyed
{
bool _InitialSyncComplete;
public event EventHandler<EventArgs> InitialSyncCompleted;
public string Key { get; private set; }
public bool InitialSyncComplete
{
get { return _InitialSyncComplete; }
private set
{
if (value == true)
{
var handler = InitialSyncCompleted;
if (handler != null)
handler(this, new EventArgs());
}
_InitialSyncComplete = value;
}
}
public bool InitialPhonebookFoldersWasReceived { get; private set; }
public bool NumberOfContactsWasReceived { get; private set; }
public bool PhonebookRootEntriesWasRecieved { get; private set; }
public bool PhonebookHasFolders { get; private set; }
public int NumberOfContacts { get; private set; }
public CodecPhonebookSyncState(string key)
{
Key = key;
CodecDisconnected();
}
public void InitialPhonebookFoldersReceived()
{
InitialPhonebookFoldersWasReceived = true;
CheckSyncStatus();
}
public void PhonebookRootEntriesReceived()
{
PhonebookRootEntriesWasRecieved = true;
CheckSyncStatus();
}
public void SetPhonebookHasFolders(bool value)
{
PhonebookHasFolders = value;
Debug.Console(1, this, "Phonebook has folders: {0}", PhonebookHasFolders);
}
public void SetNumberOfContacts(int contacts)
{
NumberOfContacts = contacts;
NumberOfContactsWasReceived = true;
Debug.Console(1, this, "Phonebook contains {0} contacts.", NumberOfContacts);
CheckSyncStatus();
}
public void CodecDisconnected()
{
InitialPhonebookFoldersWasReceived = false;
PhonebookHasFolders = false;
NumberOfContacts = 0;
NumberOfContactsWasReceived = false;
}
void CheckSyncStatus()
{
if (InitialPhonebookFoldersWasReceived && NumberOfContactsWasReceived && PhonebookRootEntriesWasRecieved)
{
InitialSyncComplete = true;
Debug.Console(1, this, "Initial Phonebook Sync Complete!");
}
else
InitialSyncComplete = false;
}
}
}

View File

@@ -9,7 +9,7 @@ using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Devices.Common.Codec
{
public class CiscoCodecPropertiesConfig
public class CiscoSparkCodecPropertiesConfig
{
public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; }

View File

@@ -278,6 +278,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
/// Converts data returned from a cisco codec to the generic Directory format.
/// </summary>
/// <param name="result"></param>
/// <param name="resultFolder"></param>
/// <returns></returns>
public static CodecDirectory ConvertCiscoPhonebookToGeneric(PhonebookSearchResult result)
{

View File

@@ -98,10 +98,10 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
/// <summary>
/// Dials, yo!
/// </summary>
public override void Dial(string s)
public override void Dial(string number)
{
Debug.Console(1, this, "Dial: {0}", s);
var call = new CodecActiveCallItem() { Name = s, Number = s, Id = s, Status = eCodecCallStatus.Dialing };
Debug.Console(1, this, "Dial: {0}", number);
var call = new CodecActiveCallItem() { Name = number, Number = number, Id = number, Status = eCodecCallStatus.Dialing };
ActiveCalls.Add(call);
OnCallStatusChange(eCodecCallStatus.Unknown, call.Status, call);
//ActiveCallCountFeedback.FireUpdate();
@@ -114,6 +114,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
}, 2000);
}
public override void Dial(Meeting meeting)
{
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
@@ -349,7 +354,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
m.StartTime = DateTime.Now.AddMinutes(3).AddHours(i);
m.EndTime = DateTime.Now.AddHours(i).AddMinutes(30);
m.Title = "Meeting " + i;
m.ConferenceNumberToDial = i + "meeting@fake.com";
m.Calls[0].Number = i + "meeting@fake.com";
_CodecSchedule.Meetings.Add(m);
}
}

View File

@@ -71,7 +71,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
#region IHasDialer Members
public abstract void Dial(string s);
public abstract void Dial(string number);
public abstract void Dial(Meeting meeting);
public abstract void EndCall(CodecActiveCallItem call);
public abstract void EndAllCalls();
public abstract void AcceptCall(CodecActiveCallItem call);
@@ -198,4 +199,98 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
CallItem = item;
}
}
/// <summary>
/// Used to track the status of syncronizing the phonebook values when connecting to a codec or refreshing the phonebook info
/// </summary>
public class CodecPhonebookSyncState : IKeyed
{
bool _InitialSyncComplete;
public event EventHandler<EventArgs> InitialSyncCompleted;
public string Key { get; private set; }
public bool InitialSyncComplete
{
get { return _InitialSyncComplete; }
private set
{
if (value == true)
{
var handler = InitialSyncCompleted;
if (handler != null)
handler(this, new EventArgs());
}
_InitialSyncComplete = value;
}
}
public bool InitialPhonebookFoldersWasReceived { get; private set; }
public bool NumberOfContactsWasReceived { get; private set; }
public bool PhonebookRootEntriesWasRecieved { get; private set; }
public bool PhonebookHasFolders { get; private set; }
public int NumberOfContacts { get; private set; }
public CodecPhonebookSyncState(string key)
{
Key = key;
CodecDisconnected();
}
public void InitialPhonebookFoldersReceived()
{
InitialPhonebookFoldersWasReceived = true;
CheckSyncStatus();
}
public void PhonebookRootEntriesReceived()
{
PhonebookRootEntriesWasRecieved = true;
CheckSyncStatus();
}
public void SetPhonebookHasFolders(bool value)
{
PhonebookHasFolders = value;
Debug.Console(1, this, "Phonebook has folders: {0}", PhonebookHasFolders);
}
public void SetNumberOfContacts(int contacts)
{
NumberOfContacts = contacts;
NumberOfContactsWasReceived = true;
Debug.Console(1, this, "Phonebook contains {0} contacts.", NumberOfContacts);
CheckSyncStatus();
}
public void CodecDisconnected()
{
InitialPhonebookFoldersWasReceived = false;
PhonebookHasFolders = false;
NumberOfContacts = 0;
NumberOfContactsWasReceived = false;
}
void CheckSyncStatus()
{
if (InitialPhonebookFoldersWasReceived && NumberOfContactsWasReceived && PhonebookRootEntriesWasRecieved)
{
InitialSyncComplete = true;
Debug.Console(1, this, "Initial Phonebook Sync Complete!");
}
else
InitialSyncComplete = false;
}
}
}

View File

@@ -190,12 +190,17 @@ namespace PepperDash.Essentials
/// <summary>
/// 1241 For touching the text area to bring up keyboard
/// </summary>
public const uint VcDirectoryTextEntryPress = 1241;
public const uint VCDirectoryTextEntryPress = 1241;
/// <summary>
/// 1242
/// </summary>
public const uint VCStagingSelfViewLayoutPress = 1242;
/// <summary>
/// 1243
/// </summary>
public const uint VCDirectoryBackVisible = 1243;
/// <summary>
/// 1251
/// </summary>

View File

@@ -30,8 +30,8 @@ namespace PepperDash.Essentials
/// 1231 - 1261 range of joins for recent list time
/// </summary>
public const uint VCRecentListTimeTextStart = 1231;
//
public const uint VCRecentListTimeTextEnd = 1260;
// RANGE IN USE
public const uint VCRecentListTimeTextEnd = 1260;
/// <summary>
/// 1291 - the current layout mode
/// </summary>
@@ -44,6 +44,32 @@ namespace PepperDash.Essentials
// RANGE IN USE
public const uint VCDirectoryListTextEnd = 1400;
/// <summary>
/// 141112
/// </summary>
public const uint VCFavorites1Text = 1411;
/// <summary>
/// 1412
/// </summary>
public const uint VCFavorites2Text = 1412;
/// <summary>
/// 1413
/// </summary>
public const uint VCFavorites3Text = 1413;
/// <summary>
/// 1414
/// </summary>
public const uint VCFavorites4Text = 1414;
/// <summary>
/// 1415
/// </summary>
public const uint VCFavorites5Text = 1415;
//******************************************************
// Keyboard
/// <summary>

View File

@@ -10,6 +10,7 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
using PepperDash.Essentials.Core.PageManagers;
using PepperDash.Essentials.Room.Config;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec;
namespace PepperDash.Essentials
@@ -408,7 +409,7 @@ namespace PepperDash.Essentials
TriList.SetSigFalseAction(UIBoolJoin.NextMeetingRibbonJoinPress, () =>
{
HideNextMeetingPopup();
RoomOnAndDialMeeting(meeting.ConferenceNumberToDial);
RoomOnAndDialMeeting(meeting);
});
TriList.SetString(UIStringJoin.NextMeetingSecondaryButtonLabel, "Show Schedule");
TriList.SetSigFalseAction(UIBoolJoin.CalendarHeaderButtonPress, () =>
@@ -459,13 +460,15 @@ namespace PepperDash.Essentials
/// <summary>
/// Dials a meeting after turning on room (if necessary)
/// </summary>
void RoomOnAndDialMeeting(string number)
void RoomOnAndDialMeeting(Meeting meeting)
{
Action dialAction = () =>
{
var d = CurrentRoom.ScheduleSource as VideoCodecBase;
if (d != null)
d.Dial(number);
if (d != null)
{
d.Dial(meeting);
}
};
if (CurrentRoom.OnFeedback.BoolValue)
dialAction();
@@ -980,7 +983,7 @@ namespace PepperDash.Essentials
PopupInterlock.Hide();
var d = CurrentRoom.ScheduleSource as VideoCodecBase;
if (d != null)
RoomOnAndDialMeeting(mm.ConferenceNumberToDial);
RoomOnAndDialMeeting(mm);
});
}
MeetingsSrl.Count = i;

View File

@@ -61,6 +61,10 @@ namespace PepperDash.Essentials.UIDrivers.VC
CodecDirectory CurrentDirectoryResult;
string LastFolderRequestedParentFolderId;
BoolFeedback DirectoryBackButtonVisibleFeedback;
// These are likely temp until we get a keyboard built
StringFeedback DialStringFeedback;
StringBuilder DialStringBuilder = new StringBuilder();
@@ -130,6 +134,12 @@ namespace PepperDash.Essentials.UIDrivers.VC
DialStringBackspaceVisibleFeedback
.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VCKeypadBackspaceVisible]);
TriList.SetSigFalseAction(UIBoolJoin.VCDirectoryBackPress, GetDirectoryParentFolderContents);
DirectoryBackButtonVisibleFeedback = new BoolFeedback(() => CurrentDirectoryResult != (codec as IHasDirectory).DirectoryRoot);
DirectoryBackButtonVisibleFeedback
.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VCDirectoryBackVisible]);
TriList.SetSigFalseAction(UIBoolJoin.VCKeypadTextPress, RevealKeyboard);
// Address and number
@@ -389,9 +399,9 @@ namespace PepperDash.Essentials.UIDrivers.VC
TriList.SetString(timeTextOffset + i, timeText);
string iconName = null;
if (c.Direction == eCodecCallDirection.Incoming)
if (c.OccurenceType == eCodecOccurrenceType.Received)
iconName = "Left";
else if (c.Direction == eCodecCallDirection.Outgoing)
else if (c.OccurenceType == eCodecOccurrenceType.Placed)
iconName = "Right";
else
iconName = "Help";
@@ -419,7 +429,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
if (i < favs.Count)
{
var fav = favs[(int)i];
TriList.SetString(1211 + i, fav.Name);
TriList.SetString(1411 + i, fav.Name);
TriList.SetBool(1221 + i, true);
TriList.SetSigFalseAction(1211 + i, () =>
{
@@ -445,7 +455,14 @@ namespace PepperDash.Essentials.UIDrivers.VC
DirectoryList = new SmartObjectDynamicList(TriList.SmartObjects[UISmartObjectJoin.VCDirectoryList],
true, 1300);
codec.DirectoryResultReturned += new EventHandler<DirectoryEventArgs>(dir_DirectoryResultReturned);
CurrentDirectoryResult = codec.DirectoryRoot;
if (codec.PhonebookSyncState.InitialSyncComplete)
SetCurrentDirectoryToRoot();
else
{
codec.PhonebookSyncState.InitialSyncCompleted += new EventHandler<EventArgs>(PhonebookSyncState_InitialSyncCompleted);
}
// If there is something here now, show it otherwise wait for the event
if (CurrentDirectoryResult != null && codec.DirectoryRoot.DirectoryResults.Count > 0)
@@ -456,6 +473,37 @@ namespace PepperDash.Essentials.UIDrivers.VC
}
}
/// <summary>
/// Sets the current directory resutls to the DirectorRoot and updates Back Button visibiltiy
/// </summary>
void SetCurrentDirectoryToRoot()
{
LastFolderRequestedParentFolderId = string.Empty;
CurrentDirectoryResult = (Codec as IHasDirectory).DirectoryRoot;
DirectoryBackButtonVisibleFeedback.FireUpdate();
RefreshDirectory();
}
/// <summary>
/// Setup the Directory list when notified that the initial phonebook sync is completed
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void PhonebookSyncState_InitialSyncCompleted(object sender, EventArgs e)
{
var codec = Codec as IHasDirectory;
SetCurrentDirectoryToRoot();
if (CurrentDirectoryResult != null && codec.DirectoryRoot.DirectoryResults.Count > 0)
{
RefreshDirectory();
}
}
/// <summary>
///
/// </summary>
@@ -464,9 +512,38 @@ namespace PepperDash.Essentials.UIDrivers.VC
void dir_DirectoryResultReturned(object sender, DirectoryEventArgs e)
{
CurrentDirectoryResult = e.Directory;
DirectoryBackButtonVisibleFeedback.FireUpdate();
RefreshDirectory();
}
/// <summary>
/// Helper method to retrieve directory folder contents and store last requested folder id
/// </summary>
/// <param name="folderId"></param>
void GetDirectoryFolderContents(DirectoryFolder folder)
{
LastFolderRequestedParentFolderId = folder.ParentFolderId;
(Codec as IHasDirectory).GetDirectoryFolderContents(folder.FolderId);
}
/// <summary>
/// Request the parent folder contents or sets back to the root if no parent folder
/// </summary>
void GetDirectoryParentFolderContents()
{
var codec = Codec as IHasDirectory;
if (!string.IsNullOrEmpty(LastFolderRequestedParentFolderId))
codec.GetDirectoryFolderContents(LastFolderRequestedParentFolderId);
else
{
SetCurrentDirectoryToRoot();
}
}
/// <summary>
///
/// </summary>
@@ -484,9 +561,11 @@ namespace PepperDash.Essentials.UIDrivers.VC
}
i++;
DirectoryList.SetItemMainText(i, r.Name);
if(r is DirectoryContact)
{
DirectoryList.SetItemMainText(i, r.Name);
var dc = r as DirectoryContact;
// if more than one contact method, pop up modal to choose
// otherwiese dial 0 entry
@@ -499,15 +578,18 @@ namespace PepperDash.Essentials.UIDrivers.VC
}
}
else
else // is DirectoryFolder
{
DirectoryList.SetItemMainText(i, string.Format("[+] {0}", r.Name));
var df = r as DirectoryFolder;
DirectoryList.SetItemButtonAction(i, b =>
{
if (!b)
{
var id = (r as DirectoryFolder).FolderId;
(Codec as IHasDirectory).GetDirectoryFolderContents(id);
// will later call event handler
GetDirectoryFolderContents(df);
// will later call event handler after folder contents retrieved
}
});
}