예제 #1
0
        /// <summary> Connects a model with a view </summary>
        /// <returns> A task that can be awaited on, that returns the fully setup presenter </returns>
        public static async Task <T> LoadModelIntoView <T>(this Presenter <T> self, T model)
        {
            AssertV2.IsNotNull(self.targetView, "presenter.targetView");
            var name = self.GetType().Name + "_((" + model.GetType().Name + "))";

            AppFlow.TrackEvent(EventConsts.catPresenter, "Load-start:" + name, self, model);
            await self.OnLoad(model);

            AppFlow.TrackEvent(EventConsts.catPresenter, "Load-done:" + name, self, model);
            return(model);
        }
예제 #2
0
파일: Log.cs 프로젝트: yazici/cscore-1
        public static StopwatchV2 MethodEntered([CallerMemberName] string methodName = null, params object[] args)
        {
#if DEBUG
            args = new StackFrame(1, true).AddTo(args);
#endif
            Log.d(" --> " + methodName, args);
            if (!methodName.IsNullOrEmpty())
            {
                AppFlow.TrackEvent(AppFlow.catMethod, methodName, args);
            }
            return(AssertV2.TrackTiming(methodName));
        }
예제 #3
0
        public static IEnumerable <T> GetAllOfType <T>() where T : IAppFlow
        {
            IAppFlow i = AppFlow.instance(null);

            if (i is AppFlowMultipleTrackers m)
            {
                return(m.trackers.OfType <T>());
            }
            if (i is T)
            {
                return(new T[1] {
                    (T)i
                });
            }
            return(null);
        }
예제 #4
0
파일: ActionMenu.cs 프로젝트: r8zbeh/cscore
        public static async Task <ActionMenu.Entry> ShowActionMenu(this ViewStack self, ActionMenu menu, string menuPrefabName = "ActionMenu/ActionMenu1")
        {
            var eventName = "ShowActionMenu " + menu.menuId;
            var timing    = Log.MethodEntered(eventName);
            var menuUiGo  = self.ShowView(menuPrefabName);
            var presenter = new ActionMenu.Presenter();

            presenter.targetView = menuUiGo;
            try {
                var selectedEntry = (await presenter.LoadModelIntoView(menu)).clickedEntry;
                menuUiGo.Destroy(); // Close the menu UI again
                AppFlow.TrackEvent(EventConsts.catMethod, eventName + " done: " + selectedEntry.name);
                Log.MethodDone(timing);
                return(selectedEntry);
            }
            catch (TaskCanceledException) { // If the user canceled the action selection:
                menuUiGo.Destroy();         // Close the menu UI again
                AppFlow.TrackEvent(EventConsts.catMethod, eventName + " canceled");
                Log.MethodDone(timing);
                return(null);
            }
        }