コード例 #1
0
ファイル: Main.cs プロジェクト: SherwinVN/WareHouse
        private async void LoadForm(object sender)
        {
            SplashScreenManager.CloseForm(false);
            SplashScreenManager.ShowForm(typeof(LoadingForm));

            IDeveloverFormChild form = await GetForm(sender);

            if (form == null)
            {
                SplashScreenManager.CloseForm(false);
                return;
            }

            if (!DeveloverOptions.StatusLogins.StatusLogin)
            {
                return;
            }

            for (int i = 0; i < MdiChildren.Length; i++)
            {
                IDeveloverFormChild f = (IDeveloverFormChild)MdiChildren[i];
                if (f.GetType().FullName == form.GetType().FullName)
                {
                    SplashScreenManager.CloseForm(false);
                    f.Activate();
                    return;
                }
            }

            form.MdiParent = this;
            form.Show();
            SplashScreenManager.CloseForm(false);
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: SherwinVN/WareHouse
        Task <IDeveloverFormChild> GetForm(object sender)
        {
            if (!(sender is BarButtonItem))
            {
                return(Task.FromResult <IDeveloverFormChild>(null));
            }

            BarButtonItem btn = sender as BarButtonItem;

            if (!btn.Name.StartsWith("_"))
            {
                return(Task.FromResult <IDeveloverFormChild>(null));
            }

            if (btn.Name.StartsWith("_1"))
            {
                return(Task.FromResult <IDeveloverFormChild>(null));
            }


            if (btn.Tag == null)
            {
                return(Task.FromResult <IDeveloverFormChild>(null));
            }
            return(Task.Run(() =>
            {
                Type type = Type.GetType("DeveloverWarehouse.Modules." + btn.Tag.ToString());
                IDeveloverFormChild f = null;
                for (int i = 0; i < MdiChildren.Length; i++)
                {
                    f = (IDeveloverFormChild)MdiChildren[i];
                    if (f.GetType().FullName == type.FullName)
                    {
                        return f;
                    }
                }

                f = (IDeveloverFormChild)Activator.CreateInstance(type);

                return f;
            }));
        }