Exemplo n.º 1
0
        private void UILink_Click(object sender, RoutedEventArgs e)
        {
            if (LinkFrame == null)
            {
                LinkFrame = (Application.Current.MainWindow as IFrame);
            }
            if (LinkFrame == null)
            {
                throw new ArgumentException("Задайте свойство LinkFrame.");
            }

            if (LinkObj == null)
            {
                //System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
                // Pack://Application:,,, /Subfolder/ResourceFile.xaml
                //+asm.GetName().Name + ";component/" +

                //Type Type = Type.GetType(LinkType.GetType().ToString());
                ////получаем конструктор

                //System.Reflection.ConstructorInfo ci = Type.GetConstructor(new Type[] { });
                ////вызываем конструтор
                //UIElement Obj =(UIElement) ci.Invoke(new object[] { });
                UIElement ui = (UIElement)LinkType.GetConstructor(new Type[] {}).Invoke(new object[] {});
                LinkFrame.SetFrame(ui);
            }
            else
            {
                LinkFrame.SetFrame(LinkObj);
            }
        }