/// <summary> /// Initialize or deinitialize Editor getting editorState /// </summary> private void ChangeEditorViewState(DetailState editorState, int?orderId) { if (_isDetailPublished) { return; } if (editorState == DetailState.Create) { OnShowView(); IsEditable = true; } else if (editorState == DetailState.Edit && orderId.HasValue) { ShowDetails(orderId.Value, DetailState.Edit); } else if (editorState == DetailState.View && orderId.HasValue) { ShowDetails(orderId.Value, DetailState.View); } else if (editorState == DetailState.Hide) { OnHideView(); } }
private void ShowDetails(int orderId, DetailState detailState) { var thread = new Thread(() => { OnShowLoader(); LoadOrderDetail(orderId); _isDetailPublished = true; _eventAggregator.GetEvent <PubSubEvent <DetailEvent> >().Publish(new DetailEvent(detailState, orderId, _orderCollection)); _isDetailPublished = false; IsEditable = detailState != DetailState.View; if (_orderCollection != null && _orderCollection.Count > 0) { foreach (var i in _orderCollection) { _eventAggregator.GetEvent <PubSubEvent <NavigationProcessEvent> >().Publish(new NavigationProcessEvent(i as IProcessable)); } } OnHideLoader(); }); thread.IsBackground = true; thread.SetApartmentState(ApartmentState.STA); thread.Start(); }
static public void AddFavourite(ContentData cData, bool chk = false) { prevState = state; pGlobal.ShowDownloadChoice(cData); Debug.Log("chk : " + chk); pGlobal.pchk = chk; }
static public void PopPDFPage(ContentData data) { #if !UNITY_IOS state = DetailState.DS_CONTENT; #endif pGlobal.contentPage.PopPDFPage(data, false); }
/// <summary> /// Initialize or deinitialize Editor getting editorState /// </summary> private void ChangeSummaryViewState(DetailState summaryState, int?orderId) { if (summaryState == DetailState.Create) { OnShowView(); IsEditable = true; } else if (summaryState == DetailState.Edit && orderId.HasValue) { OnShowView(); IsEditable = true; } else if (summaryState == DetailState.View && orderId.HasValue) { OnShowView(); IsEditable = false; } else if (summaryState == DetailState.Hide) { OnHideView(); } }
IEnumerator Waiting() { while (ContentPageFile.downloadingList.Count > 0) { yield return(null); } CreateFavourite(); state = prevState; pGlobal.waitingDialogue.SetActive(false); }
public void CancelDownloadCB() { state = prevState; #if !UNITY_WEBGL && !DISABLE_WEBVIEW if (pGlobal.pchk) { contentPage.webviewshow(); } #endif }
public DetailEvent(DetailState detailState, int?orderId = null, List <IOrderViewModel> orders = null, string status = null) { DetailState = detailState; OrderId = orderId; Status = status; if (orders != null) { OrderCollection = orders.ToList(); } }
public float ProgressCB(out string text) { //calculate progress here float progress = ContentPageFile.GetProgress(); int prText = (int)(progress * 100); text = "Downloading (" + prText.ToString() + "%)"; if (progress >= 1.0f) { //finish download // CreateFavourite (); state = prevState; } return(progress); }
public void DownloadSomeCB() { if (!pGlobal.file.AddContentToFile(FavData, false)) { PopupObject.ShowAlertPopup("Error", "ข้อมูลนี้ได้ถูกบันทึกไปแล้ว", "ปิด"); } else { state = DetailState.DS_WAITING; pGlobal.StartLoading(); } #if !UNITY_WEBGL && !DISABLE_WEBVIEW if (pGlobal.pchk) { contentPage.webviewshow(); } #endif }
/// <summary> /// Initialize or deinitialize Editor getting editorState /// </summary> private void ChangeNavigationViewState(DetailState summaryState, int?orderId, List <IOrderViewModel> orders) { if (summaryState == DetailState.Create) { IsEditable = true; InitalizeDataCollection(); if (OperationTypesDataSource != null) { foreach (var i in OperationTypesDataSource) { i.Reset(IsEditable); } } OnShowView(); } else if (summaryState == DetailState.Edit && orderId.HasValue) { IsEditable = true; if (orders != null && orders.Count > 0) { var typesSource = new List <NavigationModel>(); int index = 0; foreach (var i in orders) { var basicType = new NavigationModel(_eventAggregator, i.Type, i.ToString(), null, i.Type == 0) { Process = 100, Index = index }; typesSource.Add(basicType); index++; } if (typesSource.FirstOrDefault(x => x.Id == 1) == null) { var manualType = new NavigationModel(_eventAggregator, 1, "Ручна", typesSource.FirstOrDefault()) { Index = typesSource.Count }; typesSource.Add(manualType); } if (typesSource.FirstOrDefault(x => x.Id == 2) == null) { var additionalType = new NavigationModel(_eventAggregator, 2, "Допоміжна", typesSource.FirstOrDefault()) { Index = typesSource.Count }; typesSource.Add(additionalType); } OperationTypesDataSource = new ObservableCollection <NavigationModel>(typesSource); var items = OperationTypesDataSource.Where(x => orders.Select(y => y.Type).Contains(x.Id)); if (items != null && items.Count() > 0) { foreach (var i in items) { i.Process = 100; } } } OnShowView(); } else if (summaryState == DetailState.View && orderId.HasValue) { IsEditable = false; if (orders != null && orders.Count > 0) { var typesSource = new List <NavigationModel>(); int index = 0; foreach (var i in orders) { var basicType = new NavigationModel(_eventAggregator, i.Type, i.ToString(), null, i.Type == 0) { Process = 100, Index = index }; typesSource.Add(basicType); index++; } OperationTypesDataSource = new ObservableCollection <NavigationModel>(typesSource); var items = OperationTypesDataSource.Where(x => orders.Select(y => y.Type).Contains(x.Id)); if (items != null && items.Count() > 0) { foreach (var i in items) { i.Process = 100; } } var status = _directoryManager.LaborStatus.FirstOrDefault(x => x.Identity == orders.FirstOrDefault().StatusId); if (status != null) { _isActive = status.Name == "active"; } } OnShowView(); _canBeCanceled = IsOrderCanBeCanceled(orderId.Value); } else if (summaryState == DetailState.Hide) { OnHideView(); } if (OperationTypesDataSource != null) { var currentType = OperationTypesDataSource.FirstOrDefault(); if (currentType != null) { currentType.IsChecked = true; } } }
static public void HideContentPage() { state = DetailState.DS_LIST; pGlobal.contentPage.HideContent(); }
static public void PopContentPage(ContentData data) { state = DetailState.DS_CONTENT; pGlobal.contentPage.PopContent(data, false); }
static public void PopFavouriteContentPage(ContentData data) { state = DetailState.DS_CONTENT; pGlobal.contentPage.PopContent(data, true); }