private void ChangeCategory(UIElement button) { //initiate dialog to get the target category var catDialog = new UILotCategoryDialog(); UIScreen.GlobalShowDialog(new DialogReference { Dialog = catDialog, Controller = this, Modal = true, }); catDialog.OnCategoryChange += ChangeCategory; }
private void ChangeCategory(UIElement button) { string error = null; if (CurrentLot != null && CurrentLot.Value != null) { var hours = ((uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds - CurrentLot.Value.Lot_LastCatChange) / (60 * 60); if (hours < 168) { error = GameFacade.Strings.GetString("190", "31", new string[] { Math.Ceiling((168 - hours) / 24f).ToString() }); } if (CurrentLot.Value.Lot_IsOnline) { error = GameFacade.Strings.GetString("190", "30"); } if (CurrentLot.Value.Lot_Category == (byte)LotCategory.community) { error = GameFacade.Strings.GetString("f115", "93"); } } if (error != null) { UIScreen.GlobalShowAlert(new UIAlertOptions() { Message = error }, true); } else { //initiate dialog to get the target category var catDialog = new UILotCategoryDialog(); UIScreen.GlobalShowDialog(new DialogReference { Dialog = catDialog, Controller = this, Modal = true, }); catDialog.OnCategoryChange += ChangeCategory; } }