* UIPage: 增加FeedBack和SetParam函数,用于多页面传值
This commit is contained in:
parent
7ff0d272d6
commit
570f2daa7a
@ -4,4 +4,7 @@
|
||||
dotnet_diagnostic.IDE0090.severity = none
|
||||
|
||||
# CA1416: 验证平台兼容性
|
||||
dotnet_diagnostic.CA1416.severity = none
|
||||
dotnet_diagnostic.CA1416.severity = none
|
||||
|
||||
# CA822: 可标记为Static
|
||||
dotnet_diagnostic.CA1822.severity = none
|
Binary file not shown.
Binary file not shown.
@ -334,6 +334,46 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
public UIPage GetPage(int pageIndex)
|
||||
{
|
||||
if (pageIndex < 0) return null;
|
||||
foreach (var item in PageItems)
|
||||
{
|
||||
if (item.Value.PageIndex == pageIndex && item.Key != null)
|
||||
{
|
||||
var tabPage = item.Key;
|
||||
var pages = tabPage.GetControls<UIPage>();
|
||||
for (int i = 0; i < pages.Count; i++)
|
||||
{
|
||||
if (pages[i].PageIndex == pageIndex)
|
||||
return pages[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public UIPage GetPage(Guid guid)
|
||||
{
|
||||
if (guid == Guid.Empty) return null;
|
||||
foreach (var item in PageItems)
|
||||
{
|
||||
if (item.Value.PageGuid == guid && item.Key != null)
|
||||
{
|
||||
var tabPage = item.Key;
|
||||
var pages = tabPage.GetControls<UIPage>();
|
||||
for (int i = 0; i < pages.Count; i++)
|
||||
{
|
||||
if (pages[i].PageGuid == guid)
|
||||
return pages[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool RemovePage(int pageIndex)
|
||||
{
|
||||
if (pageIndex < 0) return false;
|
||||
|
@ -131,6 +131,10 @@ namespace Sunny.UI
|
||||
|
||||
public bool RemovePage(Guid guid) => Helper.RemovePage(guid);
|
||||
|
||||
public UIPage GetPage(int pageIndex) => Helper.GetPage(pageIndex);
|
||||
|
||||
public UIPage GetPage(Guid guid) => Helper.GetPage(guid);
|
||||
|
||||
public void AddPages(params UIPage[] pages)
|
||||
{
|
||||
foreach (var page in pages) AddPage(page);
|
||||
|
@ -1854,19 +1854,19 @@ namespace Sunny.UI
|
||||
|
||||
public UITabControl MainTabControl { get; set; }
|
||||
|
||||
public UIPage AddPage(UIPage page, int index)
|
||||
public virtual UIPage AddPage(UIPage page, int index)
|
||||
{
|
||||
page.PageIndex = index;
|
||||
return AddPage(page);
|
||||
}
|
||||
|
||||
public UIPage AddPage(UIPage page, Guid guid)
|
||||
public virtual UIPage AddPage(UIPage page, Guid guid)
|
||||
{
|
||||
page.PageGuid = guid;
|
||||
return AddPage(page);
|
||||
}
|
||||
|
||||
public UIPage AddPage(UIPage page)
|
||||
public virtual UIPage AddPage(UIPage page)
|
||||
{
|
||||
page.Frame = this;
|
||||
MainTabControl?.AddPage(page);
|
||||
@ -1883,12 +1883,12 @@ namespace Sunny.UI
|
||||
MainTabControl?.SelectPage(guid);
|
||||
}
|
||||
|
||||
public bool RemovePage(int pageIndex)
|
||||
public virtual bool RemovePage(int pageIndex)
|
||||
{
|
||||
return MainTabControl?.RemovePage(pageIndex) ?? false;
|
||||
}
|
||||
|
||||
public bool RemovePage(Guid guid)
|
||||
public virtual bool RemovePage(Guid guid)
|
||||
{
|
||||
return MainTabControl?.RemovePage(guid) ?? false;
|
||||
}
|
||||
@ -1897,6 +1897,16 @@ namespace Sunny.UI
|
||||
{
|
||||
}
|
||||
|
||||
public virtual UIPage GetPage(int pageIndex)
|
||||
{
|
||||
return MainTabControl?.GetPage(pageIndex);
|
||||
}
|
||||
|
||||
public virtual UIPage GetPage(Guid guid)
|
||||
{
|
||||
return MainTabControl?.GetPage(guid);
|
||||
}
|
||||
|
||||
#endregion IFrame实现
|
||||
}
|
||||
}
|
@ -618,25 +618,4 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface IFrame
|
||||
{
|
||||
UITabControl MainTabControl { get; }
|
||||
|
||||
UIPage AddPage(UIPage page, int index);
|
||||
|
||||
UIPage AddPage(UIPage page, Guid guid);
|
||||
|
||||
UIPage AddPage(UIPage page);
|
||||
|
||||
void SelectPage(int pageIndex);
|
||||
|
||||
bool TopMost { get; set; }
|
||||
|
||||
bool RemovePage(int pageIndex);
|
||||
|
||||
bool RemovePage(Guid guid);
|
||||
|
||||
void Feedback(object sender, int pageIndex, params object[] objects);
|
||||
}
|
||||
}
|
35
SunnyUI/Frames/IFrame.cs
Normal file
35
SunnyUI/Frames/IFrame.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
public interface IFrame
|
||||
{
|
||||
UITabControl MainTabControl { get; }
|
||||
|
||||
UIPage AddPage(UIPage page, int index);
|
||||
|
||||
UIPage AddPage(UIPage page, Guid guid);
|
||||
|
||||
UIPage AddPage(UIPage page);
|
||||
|
||||
void SelectPage(int pageIndex);
|
||||
|
||||
void SelectPage(Guid guid);
|
||||
|
||||
UIPage GetPage(int pageIndex);
|
||||
|
||||
UIPage GetPage(Guid guid);
|
||||
|
||||
bool TopMost { get; set; }
|
||||
|
||||
bool RemovePage(int pageIndex);
|
||||
|
||||
bool RemovePage(Guid guid);
|
||||
|
||||
void Feedback(object sender, int pageIndex, params object[] objects);
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@
|
||||
* 2021-07-18: V3.0.5 修复OnLoad在加载时重复加载两次的问题,增加Final函数,每次页面切换,退出页面都会执行
|
||||
* 2021-08-17: V3.0.6 增加TitleFont属性
|
||||
* 2021-08-24: V3.0.6 修复OnLoad在加载时重复加载两次的问题
|
||||
* 2021-12-01: V3.0.9 增加FeedBack和SetParam函数,用于多页面传值
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -624,6 +625,16 @@ namespace Sunny.UI
|
||||
get; set;
|
||||
}
|
||||
|
||||
public void Feedback(object sender, params object[] objects)
|
||||
{
|
||||
Frame?.Feedback(this, PageIndex, objects);
|
||||
}
|
||||
|
||||
public virtual void SetParam(int fromPageIndex, params object[] objects)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#region 一些辅助窗口
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user