internal static void Show_DishesView() { Show_WaitView("Cargando el catálogo de platillos"); //TODO select all dishes from db List <Dishes> dishes; using (var db = App.DbFactory.Open()) { dishes = db.Select <Dishes>(); } Current.Dispatcher.Invoke(() => { ParentView.Current.ProductCatalogBtn.IsEnabled = true; ParentView.Current.DishesCatalogBtn.IsEnabled = true; ParentView.Current.ConfigurationBtn.IsEnabled = true; var oldView = Current.Transition.Content as UserControl; var view = new DishesView(dishes); Current.Transition.Content = view; ViewLoaded?.Invoke(view); App.Log.Message($"DishesView", "VIEW-LOADED"); if (!(oldView is WaitView)) { ViewUnloaded?.Invoke(oldView); } }); }
protected override void LoadContent() { _inited = true; if (_mainView == null) { return; } _drawBatch = new AdvancedDrawBatch(GraphicsDevice); ContentLoading?.Invoke(this); IDefinitionClass obj = _mainView.CreateInstance(null, null); MainView = (UiContainer)obj; MainView.RecalculateAll(); MainView.RegisterView(); MainView.ViewAdded(); ViewLoaded?.Invoke(this); MainView.Bounds = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height); }
internal static void Show_AddIngredientsView(Dishes dish) { Show_WaitView("Cargando las lista de productos"); //TODO select all products from db List <Products> products; using (var db = App.DbFactory.Open()) { products = db.Select <Products>(); } Current.Dispatcher.Invoke(() => { ParentView.Current.ProductCatalogBtn.IsEnabled = false; ParentView.Current.DishesCatalogBtn.IsEnabled = false; ParentView.Current.ConfigurationBtn.IsEnabled = false; var oldView = Current.Transition.Content as UserControl; var view = new AddIngredientsView(dish, products); Current.Transition.Content = view; ViewLoaded?.Invoke(view); App.Log.Message($"AddIngredientsView. Dish: {dish.ToString()}\nProducts: {products.Serialize(LibreR.Models.Enums.Serializer.OneLine)}", "VIEW-LOADED"); if (!(oldView is WaitView)) { ViewUnloaded?.Invoke(oldView); } }); }
private void View_Load(object sender, EventArgs e) { if (ViewLoaded != null) { ViewLoaded.Invoke(this, e); } }
public SystemBlockForm() { InitializeComponent(); boxes = new List <ListBox>(); presenter = new SystemBlockPresenter(this); ViewLoaded.Invoke(); }
private void OrderAddAmendView_Load(object sender, EventArgs e) { ViewLoaded?.Invoke(this, EventArgs.Empty); this.OrderRef.Text = _presenterAddAmend._OrderRef; this.Item.Text = _presenterAddAmend._ItemDesc; this.Customer.Text = _presenterAddAmend._Customer; this.Qty.Text = _presenterAddAmend._Qty.ToString(); this.UnitCost.Text = _presenterAddAmend._UnitCost.ToString(); }
/// <summary> /// Initializes a new instance of the <see cref="UIViewController"/> class. /// </summary> public UIViewController() { if (CatelEnvironment.IsInDesignMode) { return; } var viewModelType = GetViewModelType(); if (viewModelType is null) { Log.Debug("GetViewModelType() returned null, using the ViewModelLocator to resolve the view model"); viewModelType = _viewModelLocator.ResolveViewModel(GetType()); if (viewModelType is null) { const string error = "The view model of the view could not be resolved. Use either the GetViewModelType() method or IViewModelLocator"; Log.Error(error); throw new NotSupportedException(error); } } _logic = new PageLogic(this, viewModelType); _logic.TargetViewPropertyChanged += (sender, e) => { OnPropertyChanged(e); PropertyChanged?.Invoke(this, e); }; _logic.ViewModelChanged += (sender, e) => RaiseViewModelChanged(); _logic.ViewModelPropertyChanged += (sender, e) => { OnViewModelPropertyChanged(e); ViewModelPropertyChanged?.Invoke(this, e); }; _logic.DetermineViewModelInstance += (sender, e) => { e.ViewModel = GetViewModelInstance(e.DataContext); }; _logic.DetermineViewModelType += (sender, e) => { e.ViewModelType = GetViewModelType(e.DataContext); }; _logic.ViewLoading += (sender, e) => ViewLoading?.Invoke(this); _logic.ViewLoaded += (sender, e) => ViewLoaded?.Invoke(this); _logic.ViewUnloading += (sender, e) => ViewUnloading?.Invoke(this); _logic.ViewUnloaded += (sender, e) => ViewUnloaded?.Invoke(this); }
internal static void Show_MessageView(string message, Action affirmativeAction = null, string ABtnContent = null, Action negativeAction = null, string BBtnContent = null, FontAwesomeIcon icon = FontAwesomeIcon.None) { Current.Dispatcher.Invoke(() => { ParentView.Current.ProductCatalogBtn.IsEnabled = false; ParentView.Current.DishesCatalogBtn.IsEnabled = false; ParentView.Current.ConfigurationBtn.IsEnabled = false; var oldView = Current.Transition.Content as UserControl; var view = new MessageView(message, affirmativeAction, ABtnContent, negativeAction, BBtnContent, icon); Current.Transition.Content = view; ViewLoaded?.Invoke(view); App.Log.Message($"MessageView, Icon: {icon}, Message: {message}", "VIEW-LOADED"); if (!(oldView is WaitView)) { ViewUnloaded?.Invoke(oldView); } }); }
internal static void Show_MainView() { Current.Dispatcher.Invoke(() => { ParentView.Current.ProductCatalogBtn.IsEnabled = true; ParentView.Current.DishesCatalogBtn.IsEnabled = true; ParentView.Current.ConfigurationBtn.IsEnabled = true; var oldView = Current.Transition.Content as UserControl; var view = new MainView(); Current.Transition.Content = view; ViewLoaded?.Invoke(view); App.Log.Message($"MainView", "VIEW-LOADED"); if (!(oldView is WaitView)) { ViewUnloaded?.Invoke(oldView); } }); }
internal static void Show_AddDishPhoto(Dishes dish) { Current.Dispatcher.Invoke(() => { ParentView.Current.ProductCatalogBtn.IsEnabled = false; ParentView.Current.DishesCatalogBtn.IsEnabled = false; ParentView.Current.ConfigurationBtn.IsEnabled = false; var oldView = Current.Transition.Content as UserControl; var view = new AddDishPhotoView(dish); Current.Transition.Content = view; ViewLoaded?.Invoke(view); App.Log.Message($"AddDishPhotoView. Dish: {dish.ToString()}", "VIEW-LOADED"); if (!(oldView is WaitView)) { ViewUnloaded?.Invoke(oldView); } }); }
internal static void Show_NewProductView(Products product = null) { Current.Dispatcher.Invoke(() => { ParentView.Current.ProductCatalogBtn.IsEnabled = false; ParentView.Current.DishesCatalogBtn.IsEnabled = false; ParentView.Current.ConfigurationBtn.IsEnabled = false; var oldView = Current.Transition.Content as UserControl; var view = new NewProductView(product); Current.Transition.Content = view; ViewLoaded?.Invoke(view); App.Log.Message($"NewProductView, Product: {product.Serialize(LibreR.Models.Enums.Serializer.OneLine)}", "VIEW-LOADED"); if (!(oldView is WaitView)) { ViewUnloaded?.Invoke(oldView); } }); }
public void ReloadView(string path) { DefinitionFile file = ContentLoader.Current.Load <DefinitionFile>(path); _mainView = file; IDefinitionClass obj = _mainView.CreateInstance(null, null); MainView = (UiContainer)obj; MainView.RecalculateAll(); MainView.RegisterView(); MainView.ViewAdded(); ViewLoaded?.Invoke(this); MainView.Bounds = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height); }
protected override void OnApplyTemplate() { _contentContainer = GetTemplateChild("ContentContainer") as Grid; _readerView = GetTemplateChild("ReaderView") as ReaderView; _readerView.PrevPageSelected += OnPrevPageSelected; _readerView.NextPageSelected += OnNextPageSelected; _readerView.LoadingStatusChanged += OnLoad; _readerView.ProgressChanged += OnProgressChanged; _readerView.TouchHolding += OnTouchHolding; _readerView.TouchTapped += (_s, _e) => { TouchTapped?.Invoke(_s, _e); }; _readerView.Loaded += (_s, _e) => { _readerView.SingleColumnMaxWidth = SingleColumnMaxWidth; _readerView.ReaderFlyout = ReaderFlyout; ViewLoaded?.Invoke(this, EventArgs.Empty); }; _readerView.LinkTapped += (_s, _e) => { LinkTapped?.Invoke(this, _e); }; _readerView.ImageTapped += (_s, _e) => { ImageTapped?.Invoke(this, _e); }; _rootGrid = GetTemplateChild("RootGrid") as Grid; base.OnApplyTemplate(); }
/// <summary> /// 加载自定义视图(通常用于在线阅读) /// </summary> /// <param name="chapters">目录列表</param> /// <param name="style">视图样式</param> /// <param name="details">目录详情列表(其中包含单个章节的内容)</param> public void LoadCustomView(List <Chapter> chapters, TxtViewStyle style, List <ChapterDetail> details = null) { if (chapters == null || chapters.Count == 0 || style == null) { throw new ArgumentNullException(); } ReaderType = Enums.ReaderType.Custom; Chapters = chapters; if (_mainPresenter.Content == null || !(_mainPresenter.Content is TxtView)) { if (_txtView == null) { _txtView = new TxtView(); _txtView.PrevPageSelected += OnPrevPageSelected; _txtView.NextPageSelected += OnNextPageSelected; _txtView.LoadingStatusChanged += OnLoad; _txtView.ProgressChanged += OnProgressChanged; _txtView.TouchHolding += OnTouchHolding; _txtView.TouchTapped += (_s, _e) => { TouchTapped?.Invoke(_s, _e); }; _txtView.Loaded += (_s, _e) => { _txtView.SingleColumnMaxWidth = SingleColumnMaxWidth; _txtView.ReaderFlyout = ReaderFlyout; ViewLoaded?.Invoke(this, EventArgs.Empty); }; } _mainPresenter.Content = _txtView; } _txtView.ViewStyle = style; if (details != null) { CustomChapterDetailList = details; } else { CustomChapterDetailList = new List <ChapterDetail>(); } }
private void RaiseViewLoaded() { ViewLoaded?.Invoke(this, new ViewStackPartEventArgs(_viewInfo.View)); MarkAsLoaded(); }
private void SettingsView_Load(object sender, EventArgs e) { ViewLoaded?.Invoke(sender, e); }
/// <summary> /// 打开书籍文件 /// </summary> /// <param name="bookFile">书籍文件</param> /// <param name="style">阅读器样式</param> /// <returns></returns> public async Task OpenAsync(StorageFile bookFile, ReaderStyle style) { if (bookFile == null) { throw new ArgumentNullException(); } string extension = Path.GetExtension(bookFile.Path).ToLower(); if (extension != ".epub" && extension != ".txt") { throw new NotSupportedException("File type not support (Currently only support txt and epub file)"); } OpenStarting?.Invoke(this, EventArgs.Empty); if (extension == ".txt") { if (!(style is TxtViewStyle)) { throw new ArgumentException("Open txt file need TxtViewStyle argument"); } ReaderType = Enums.ReaderType.Txt; Chapters = await GetTxtChapters(bookFile); ChapterLoaded?.Invoke(this, Chapters); if (_mainPresenter.Content == null || !(_mainPresenter.Content is TxtView)) { if (_txtView == null) { _txtView = new TxtView(); _txtView.PrevPageSelected += OnPrevPageSelected; _txtView.NextPageSelected += OnNextPageSelected; _txtView.LoadingStatusChanged += OnLoad; _txtView.ProgressChanged += OnProgressChanged; _txtView.TouchHolding += OnTouchHolding; _txtView.TouchTapped += (_s, _e) => { TouchTapped?.Invoke(_s, _e); }; _txtView.Loaded += (_s, _e) => { _txtView.SingleColumnMaxWidth = SingleColumnMaxWidth; _txtView.ReaderFlyout = ReaderFlyout; ViewLoaded?.Invoke(this, EventArgs.Empty); }; } _mainPresenter.Content = _txtView; } _txtContent = await GetTxtContent(bookFile); _txtView.ViewStyle = style as TxtViewStyle; } else { if (!(style is EpubViewStyle)) { throw new ArgumentException("Open epub file need EpubViewStyle argument"); } ReaderType = Enums.ReaderType.Epub; _epubContent = await EpubReader.Read(bookFile, Encoding.Default); Chapters = GetEpubChapters(_epubContent); ChapterLoaded?.Invoke(this, Chapters); if (_mainPresenter.Content == null || !(_mainPresenter.Content is EpubView)) { if (_epubView == null) { _epubView = new EpubView(); _epubView.PrevPageSelected += OnPrevPageSelected; _epubView.NextPageSelected += OnNextPageSelected; _epubView.LoadingStatusChanged += OnLoad; _epubView.ProgressChanged += OnProgressChanged; _epubView.TouchHolding += OnTouchHolding; _epubView.TouchTapped += (_s, _e) => { TouchTapped?.Invoke(_s, _e); }; _epubView.Loaded += (_s, _e) => { _epubView.SingleColumnMaxWidth = SingleColumnMaxWidth; _epubView.ReaderFlyout = ReaderFlyout; ViewLoaded?.Invoke(this, EventArgs.Empty); }; _epubView.LinkTapped += (_s, _e) => { LinkTapped?.Invoke(this, _e); }; _epubView.ImageTapped += (_s, _e) => { ImageTapped?.Invoke(this, _e); }; } _mainPresenter.Content = _epubView; } _epubView.Init(_epubContent, style as EpubViewStyle); } OpenCompleted?.Invoke(this, EventArgs.Empty); }
//Local Methods private void HomeView_Load(object sender, EventArgs e) { ViewLoaded?.Invoke(this, new EventArgs()); }
/// <summary> /// Déclenche l'évenement ViewLoaded /// </summary> protected virtual void OnViewLoaded() { ViewLoaded?.Invoke(this, EventArgs.Empty); LoadCommand.Execute(); }