mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-14 20:24:57 +00:00
refactor: Add RefreshDirectory overload
This allows the directory to be refreshed by the event that updates the directory correctly
This commit is contained in:
@@ -1041,22 +1041,21 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
void SetupDirectoryList()
|
void SetupDirectoryList()
|
||||||
{
|
{
|
||||||
var codec = Codec as IHasDirectory;
|
var codec = Codec as IHasDirectory;
|
||||||
if (codec != null)
|
if (codec == null)
|
||||||
{
|
{
|
||||||
DirectoryList = new SmartObjectDynamicList(TriList.SmartObjects[UISmartObjectJoin.VCDirectoryList],
|
return;
|
||||||
true, 1300);
|
}
|
||||||
codec.DirectoryResultReturned += new EventHandler<DirectoryEventArgs>(dir_DirectoryResultReturned);
|
|
||||||
|
|
||||||
if (codec.PhonebookSyncState.InitialSyncComplete)
|
DirectoryList = new SmartObjectDynamicList(TriList.SmartObjects[UISmartObjectJoin.VCDirectoryList],
|
||||||
SetCurrentDirectoryToRoot();
|
true, 1300);
|
||||||
else
|
codec.DirectoryResultReturned += dir_DirectoryResultReturned;
|
||||||
{
|
|
||||||
codec.PhonebookSyncState.InitialSyncCompleted += new EventHandler<EventArgs>(PhonebookSyncState_InitialSyncCompleted);
|
|
||||||
}
|
|
||||||
|
|
||||||
RefreshDirectory();
|
if (codec.PhonebookSyncState.InitialSyncComplete)
|
||||||
|
SetCurrentDirectoryToRoot();
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
codec.PhonebookSyncState.InitialSyncCompleted += PhonebookSyncState_InitialSyncCompleted;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1064,11 +1063,15 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
void SetCurrentDirectoryToRoot()
|
void SetCurrentDirectoryToRoot()
|
||||||
{
|
{
|
||||||
(Codec as IHasDirectory).SetCurrentDirectoryToRoot();
|
var hasDirectory = Codec as IHasDirectory;
|
||||||
|
|
||||||
|
if (hasDirectory == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hasDirectory.SetCurrentDirectoryToRoot();
|
||||||
SearchKeypadClear();
|
SearchKeypadClear();
|
||||||
|
|
||||||
RefreshDirectory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1080,12 +1083,17 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
{
|
{
|
||||||
var codec = Codec as IHasDirectory;
|
var codec = Codec as IHasDirectory;
|
||||||
|
|
||||||
if (codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue)
|
if (codec == null)
|
||||||
{
|
{
|
||||||
SetCurrentDirectoryToRoot();
|
return;
|
||||||
|
|
||||||
RefreshDirectory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetCurrentDirectoryToRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1095,8 +1103,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)
|
||||||
{
|
{
|
||||||
|
RefreshDirectory(e.Directory);
|
||||||
RefreshDirectory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1125,16 +1132,27 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dir"></param>
|
void RefreshDirectory()
|
||||||
void RefreshDirectory()
|
|
||||||
{
|
{
|
||||||
if ((Codec as IHasDirectory).CurrentDirectoryResult.CurrentDirectoryResults.Count > 0)
|
var codec = Codec as IHasDirectory;
|
||||||
|
|
||||||
|
if (codec == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RefreshDirectory(codec.CurrentDirectoryResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RefreshDirectory(CodecDirectory directory)
|
||||||
|
{
|
||||||
|
if (directory.CurrentDirectoryResults.Count > 0)
|
||||||
{
|
{
|
||||||
ushort i = 0;
|
ushort i = 0;
|
||||||
foreach (var r in (Codec as IHasDirectory).CurrentDirectoryResult.CurrentDirectoryResults)
|
foreach (var r in directory.CurrentDirectoryResults)
|
||||||
{
|
{
|
||||||
if (i == DirectoryList.MaxCount)
|
if (i == DirectoryList.MaxCount)
|
||||||
{
|
{
|
||||||
@@ -1154,12 +1172,13 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
// If more than one contact method, show contact method modal dialog
|
// If more than one contact method, show contact method modal dialog
|
||||||
DirectoryList.SetItemButtonAction(i, b =>
|
DirectoryList.SetItemButtonAction(i, b =>
|
||||||
{
|
{
|
||||||
if (!b)
|
if (b)
|
||||||
{
|
{
|
||||||
// Refresh the contact methods list
|
return;
|
||||||
RefreshContactMethodsModalList(dc);
|
|
||||||
Parent.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.MeetingsOrContacMethodsListVisible);
|
|
||||||
}
|
}
|
||||||
|
// Refresh the contact methods list
|
||||||
|
RefreshContactMethodsModalList(dc);
|
||||||
|
Parent.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.MeetingsOrContacMethodsListVisible);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1206,8 +1225,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
|
|
||||||
DirectoryList.SetItemMainText(1, "No Results Found");
|
DirectoryList.SetItemMainText(1, "No Results Found");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void RefreshContactMethodsModalList(DirectoryContact contact)
|
void RefreshContactMethodsModalList(DirectoryContact contact)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user