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

View File

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