aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.FileSystem/Network/InitWebRtcResponse.cs
blob: 3425a90964e9b85fd70be1118256fbe6240633ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.FileSystem.Network
{
    public class InitWebRtcResponse
    {
    }
}
ht .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
using Microsoft.Practices.ServiceLocation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Tango.BL;
using Tango.BL.Entities;
using Tango.MachineStudio.Common;
using Tango.MachineStudio.Common.StudioApplication;
using Tango.SharedUI;

namespace Tango.MachineStudio.DB.ViewModels
{
    public class MainViewVM : ViewModel, IModuleRequestListener
    {
        public MainViewVM() : base()
        {

        }

        public void OnRequestModule(IStudioModule module, object args)
        {
            if (module is DBModule && args != null && args is IObservableEntity)
            {
                String vmName = args.GetType().Name + "sViewVM";
                
                Type vmType = Assembly.GetAssembly(typeof(MainViewVM)).GetTypes().SingleOrDefault(x => x.Name == vmName);

                if (vmType == null)
                {
                    vmName = args.GetType().BaseType.Name + "sViewVM";
                    vmType = Assembly.GetAssembly(typeof(MainViewVM)).GetTypes().SingleOrDefault(x => x.Name == vmName);
                }

                if (vmType != null)
                {
                    var vm = ServiceLocator.Current.GetInstance(vmType);
                    vmType.GetProperty("SelectedEntity").SetValue(vm, args);
                    vmType.GetMethod("OnEdit", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(vm, new object[] { });
                }
            }
        }
    }
}