public AppViewMediator(IAppView view, IAppController controller)
        {
            _view       = view;
            _controller = controller;

            view.Load += View_Load;
        }
Beispiel #2
0
        public static void Init(Assembly assembly, IAppView appView, string userConfigPath = "")
        {
            if (null != Instance)
            {
                throw new NotSupportedException();
            }

            Instance = new AppViewModel(assembly, appView, userConfigPath);
        }
Beispiel #3
0
        private AppViewModel(Assembly assembly, IAppView appView, string userConfigPath)
        {
            AppInfo.Assembly = assembly ?? throw new ArgumentNullException(nameof(assembly));
            AppView          = appView ?? throw new ArgumentNullException(nameof(appView));
            UserConfigPath   = userConfigPath;

            AppConfig  = new ConfigFile(DefaultConfig, ConfigFile.AppLevelKey);
            UserConfig = new ConfigFile(AppConfig, ConfigFile.UserLevelKey);
        }
Beispiel #4
0
        public AppController(IAppView appView, IUpdateStockItemView updateStockItemView, Stock stock)
        {
            AppView             = appView;
            UpdateStockItemVIew = updateStockItemView;
            Stock = stock;

            while (true)
            {
                GetUserInput();
            }
        }
        /// <summary>
        /// Searches the view for the specified components recursively. Returns an empty array if no components found.
        /// </summary>
        public static T[] GetComponentsRecursive <T>(this IAppView view) where T : class
        {
            var result = new List <T>();

            foreach (var go in view)
            {
                go.GetComponentsInChildren(true, result);
            }

            return(result.ToArray());
        }
        /// <summary>
        /// Searches the view root for the specified components. Returns an empty array if no components found.
        /// </summary>
        public static T[] GetComponents <T>(this IAppView view) where T : class
        {
            var result = new List <T>();

            foreach (var go in view)
            {
                go.GetComponents(result);
            }

            return(result.ToArray());
        }
        /// <summary>
        /// Searches the view for the specified component recursively. Returns <c>null</c> if no components found.
        /// </summary>
        public static T GetComponentRecursive <T>(this IAppView view) where T : class
        {
            foreach (var go in view)
            {
                var c = go.GetComponentInChildren <T>(true);

                if (c != null)
                {
                    return(c);
                }
            }

            return(null);
        }
        /// <summary>
        /// Searches the view root for the specified component. Returns <c>null</c> if no components found.
        /// </summary>
        public static T GetComponent <T>(this IAppView view) where T : class
        {
            foreach (var go in view)
            {
                var c = go.GetComponent <T>();

                if (c != null)
                {
                    return(c);
                }
            }

            return(null);
        }
Beispiel #9
0
        public AppController(
            IAppView view,
            IFileSystem fileSystem,
            IVirtualDesktopState desktopProvider,
            IConfigurationController configurationController,
            IConfigurationFactory configurationFactory)
        {
            _view       = view;
            _fileSystem = fileSystem;

            _desktopState = desktopProvider;
            desktopProvider.PropertyChanging += DesktopProvider_PropertyChanging;

            _configurationController = configurationController;
            _configurationFactory    = configurationFactory;
        }
Beispiel #10
0
 internal void _View_AppClosing(IAppView sender, AppClosingEventArgs ea)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Beispiel #11
0
 internal void _View_ShowWorkSpaceProperties(IAppView sender, RequestWorkSpacePropertiesEventArgs ea)
 {
     IWorkSpaceProperties props = WorkSpacePresenter.WSProperties;
     View.ShowWorkSpacePropertyView(props);
 }
Beispiel #12
0
 internal void _View_SelectAllInWorkSpace(IAppView sender, SelectAllInWorkSpaceEventArgs ea)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Beispiel #13
0
 internal void _View_SaveWorkSpace(IAppView sender, SaveWorkSpaceEventArgs ea)
 {
     if (sender != null)
         Save(ea.WorkSpaceId, ea.FileName, ea.Format);
 }
Beispiel #14
0
 internal void _View_OpenWorkSpace(IAppView sender, OpenWorkSpaceEventArgs ea)
 {
     if (sender != null)
         OpenWorkSpace(ea.FileName, ea.Format);
 }
Beispiel #15
0
 internal void _View_NewWorkSpace(IAppView sender, NewWorkSpaceEventArgs ea)
 {
     if (sender!=null)
     {
         CreateWorkSpaceMVP();
     }
 }
 public static void Mediate(IAppView view, IAppController controller)
 {
     new AppViewMediator(view, controller);
 }
Beispiel #17
0
 internal void _View_ActiveWorkSpaceChanged(IAppView sender, ActiveWorkSpaceChangedEventArgs ea)
 {
     throw new Exception("The method or operation is not implemented.");
 }