fixed vc directory browsing to properly sync between MC and Essentials UIs

This commit is contained in:
Neil Dorin
2019-03-07 15:20:24 -07:00
parent 84ee743ff5
commit 52ac57c080
3 changed files with 49 additions and 24 deletions

View File

@@ -40,6 +40,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
if (dirCodec != null)
{
dirCodec.DirectoryResultReturned += new EventHandler<DirectoryEventArgs>(dirCodec_DirectoryResultReturned);
}
var recCodec = codec as IHasCallHistory;
@@ -74,12 +75,30 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <param name="e"></param>
void dirCodec_DirectoryResultReturned(object sender, DirectoryEventArgs e)
{
PostStatusMessage(new
{
currentDirectory = e.Directory
});
SendDirectory((Codec as IHasDirectory).CurrentDirectoryResult, e.DirectoryIsOnRoot);
}
/// <summary>
/// Posts the current directory
/// </summary>
void SendDirectory(CodecDirectory directory, bool isRoot)
{
var dirCodec = Codec as IHasDirectory;
if (dirCodec != null)
{
var directoryMessage = new
{
currentDirectory = new
{
directoryResults = directory.CurrentDirectoryResults,
isRootDirectory = isRoot
}
};
PostStatusMessage(directoryMessage);
}
}
/// <summary>
///
/// </summary>
@@ -130,6 +149,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
appServerController.AddAction(MessagePath + "/getDirectory", new Action(GetDirectoryRoot));
appServerController.AddAction(MessagePath + "/directoryById", new Action<string>(s => GetDirectory(s)));
appServerController.AddAction(MessagePath + "/directorySearch", new Action<string>(s => DirectorySearch(s)));
appServerController.AddAction(MessagePath + "/directoryBack", new Action(GetPreviousDirectory));
}
// History actions
@@ -228,12 +248,28 @@ namespace PepperDash.Essentials.AppServer.Messengers
return;
}
PostStatusMessage(new
{
currentDirectory = dirCodec.DirectoryRoot
});
dirCodec.SetCurrentDirectoryToRoot();
//PostStatusMessage(new
//{
// currentDirectory = dirCodec.DirectoryRoot
//});
}
/// <summary>
/// Requests the parent folder contents
/// </summary>
void GetPreviousDirectory()
{
var dirCodec = Codec as IHasDirectory;
if (dirCodec == null)
{
return;
}
dirCodec.GetDirectoryParentFolderContents();
}
/// <summary>
/// Handler for codec changes
/// </summary>
@@ -284,6 +320,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
},
showSelfViewByDefault = Codec.ShowSelfViewByDefault,
hasDirectory = Codec is IHasDirectory,
hasDirectorySearch = true,
hasRecents = Codec is IHasCallHistory,
hasCameras = Codec is IHasCameraControl
});

View File

@@ -58,16 +58,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
SmartObjectDynamicList RecentCallsList;
SmartObjectDynamicList DirectoryList;
//CodecDirectory CurrentDirectoryResult;
///// <summary>
///// Tracks the directory browse history when browsing beyond the root directory
///// </summary>
//List<CodecDirectory> DirectoryBrowseHistory;
bool NextDirectoryResultIsFolderContents;
BoolFeedback DirectoryBackButtonVisibleFeedback;
// These are likely temp until we get a keyboard built
@@ -558,6 +549,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
{
(Codec as IHasDirectory).SetCurrentDirectoryToRoot();
#warning Deal with this recursive issue
SearchKeypadClear();
RefreshDirectory();
@@ -585,10 +577,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
/// <param name="e"></param>
void dir_DirectoryResultReturned(object sender, DirectoryEventArgs e)
{
if (NextDirectoryResultIsFolderContents)
{
NextDirectoryResultIsFolderContents = false;
}
RefreshDirectory();
}
@@ -600,7 +589,6 @@ namespace PepperDash.Essentials.UIDrivers.VC
{
(Codec as IHasDirectory).GetDirectoryFolderContents(folder.FolderId);
NextDirectoryResultIsFolderContents = true;
}
/// <summary>
@@ -614,7 +602,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
{
codec.GetDirectoryParentFolderContents();
RefreshDirectory();
//RefreshDirectory();
}
}