public override ControllerRequest View(object model) { Console.Clear(); Console.CursorVisible = false; IPerson currentUser = ApplicationData.CurrentData.CurrentPerson; int left = 3; int pos = 2; ViewTools.Txt(top: pos++, left: left, text: "Главный экран пользователя"); ViewTools.Txt(top: pos++, left: left, text: $"Пользователь: {currentUser.FirstName}, {currentUser.LastName}"); ViewTools.Txt(top: pos++, left: left, text: "--------------------------------------------"); pos++; ViewTools.Txt(top: pos++, left: left, text: "(1). Добавить часы работы"); ViewTools.Txt(top: pos++, left: left, text: "(2). Выход из программы"); ViewTools.Txt(top: pos++, left: left, text: "(3). Сменить пользователя"); pos++; ViewTools.Txt(top: pos, left: left, text: "Ваш выбор : "); FieldList fields = new FieldList().Add(new ChooseField(top: pos++, left: left + 13, name: "Choose", chooseConvert: ChooseConvert)); eViewStatus inputFieldResult = fields.Input(); return(new ControllerRequest <UserMainController>(inputFieldResult, fields.ToResultValueList())); }
void Init(bool overrideLayout) { if (!overrideLayout) { Padding = ViewTools.GetPlatformMargins(); } }
public void OnOpen(object data) { if (data == null) { Debug.LogErrorFormat("GameOverViewModule.Open(GameOverType) is null "); return; } GameOverType type = (GameOverType)data; var dic = ViewTools.CollectAllGameObjects(m_gameObject); m_button = dic["GameOverButton"].GetComponent <Button>(); if (m_button != null) { m_button.onClick.AddListener(OnClickButton); } m_winObj = dic["win"]; m_failureObj = dic["lose"]; if (m_winObj != null) { m_winObj.SetActive(type == GameOverType.Win); } if (m_failureObj != null) { m_failureObj.SetActive(type == GameOverType.Failure); } }
/// <summary> /// /// </summary> /// <param name="motionId"></param> /// <param name="attType"> /// 0: Att-sats, /// 1: Tilläggsyrkande, /// 2: PS att-sats /// 3: Program-att /// 4: Program-tilläggsyrkande /// </param> /// <returns></returns> public async Task <IActionResult> OnGetAddAttAsync(int motionId, int attType) { int nextNumber = 1; // If this is a program att. if (attType == 3 || attType == 4) { var lastAtt = await _context.Att .Where(a => a.ProgramId == motionId) .LastOrDefaultAsync(); if (lastAtt != null) { nextNumber = lastAtt.AttNumber + 1; } } else { var lastAtt = await _context.Att .Where(a => a.MotionId == motionId) .LastOrDefaultAsync(); if (lastAtt != null) { nextNumber = lastAtt.AttNumber + 1; } } return(ViewTools.GetPartialView("Att/_AddAtt", Tuple.Create(motionId, nextNumber, attType))); }
/// <summary> /// /// </summary> /// <param name="targetType"></param> public SleepDescriptionView(TargetType targetType) { SetBinding(ContentView.BackgroundColorProperty, new Binding("BackgroundColor")); BindingContext = new { BackgroundColor = StyledBackground }; Label contentLabel = new Label() { Text = ViewTools.GetTargetDescription(targetType), FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), FontAttributes = FontAttributes.Bold, TextColor = Color.FromHex("383838") }; contentLabel.SetBinding(Label.TextColorProperty, new Binding("TextColor")); contentLabel.BindingContext = new { TextColor = StyledText }; Content = new StackLayout() { Padding = new Thickness(5), Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.Center, Children = { contentLabel } }; }
/// <summary> /// The ChromiumWebBrowserControl does not fire MouseEnter/Move/Leave events, because Chromium handles these. /// This method provides a demo of hooking the Chrome_RenderWidgetHostHWND handle to receive low level messages. /// You can likely hook other window messages using this technique, drag/drop etc /// </summary> private void SetupMessageInterceptor() { if (messageInterceptor != null) { messageInterceptor.ReleaseHandle(); messageInterceptor = null; } IntPtr browserHandle = default(IntPtr); Invoke(new Action(() => { browserHandle = browser.Handle; })); Task.Run(() => { try { while (true) { IntPtr chromeWidgetHostHandle; if (ChromeWidgetHandleFinder.TryFindHandle(browserHandle, out chromeWidgetHostHandle)) { messageInterceptor = new ChromeWidgetMessageInterceptor((Control)browser, chromeWidgetHostHandle, message => { // Render process switch happened, need to find the new handle if (message.Msg == ViewTools.WM_DESTROY) { SetupMessageInterceptor(); return; } if (message.Msg == ViewTools.WM_LBUTTONDOWN) { Point point = new Point(message.LParam.ToInt32()); // handdles moving the window via -webkit-app-region: drag; if (((DragHandler)browser.DragHandler).draggableRegion.IsVisible(point)) { ViewTools.ReleaseCapture(); this.InvokeOnUiThreadIfRequired(() => { Task.Run(() => ViewTools.SendMessage(Handle, ViewTools.WM_NCLBUTTONDOWN, ViewTools.HT_CAPTION, 0)); }); } } }); break; } else { // Chrome hasn't yet set up its message-loop window. System.Threading.Thread.Sleep(10); } } } catch { // Errors are likely to occur if browser is disposed, and no good way to check from another thread } }); }
public PartialViewResult _DropDownPeople(Person person) { Func <Person, String> text = p => p.Surname.ToUpper() + ", " + p.Firstname; Func <Person, String> value = p => p.PersonID.ToString(); Predicate <Person> disable = p => !p.Active; List <SelectListItem> list = ViewTools.ToSelectListItem <Person>(person, db.People.ToList(), text, value, disable); return(PartialView("_DropDownPeople", list)); }
public StyledNavigationPage(ContentPage mainPage, bool overrideLayout = false) : base(mainPage) { InitializeComponent(); if (!overrideLayout) { Padding = ViewTools.GetPlatformMargins(); } }
public void OnOpen(object data) { var dic = ViewTools.CollectAllGameObjects(m_gameObject); m_button = dic["Button"].GetComponent <Button>(); if (m_button != null) { m_button.onClick.AddListener(OnClickButton); } }
/// <summary> /// Handles the clicked async. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> async void Handle_ClickedAsync(object sender, System.EventArgs e) { bool allCompleted = true; foreach (var view in feedbackStackLayout.Children) { var mView = view as RatingStars; if (mView != null) { if (mView.SelectedRating == -1) { allCompleted = false; } } } if (allCompleted) { string returnString = ViewTools.CommaSeparatedValue("Question,Rating", feedbackStackLayout, startTime, DateTime.Now.Subtract(startTime)); int result = await App.Database.SaveItemAsync(new SleepFeedbackModel() { CSV = returnString }); if (CrossConnectivity.Current.IsConnected) { CancellationTokenSource cancelSrc = new CancellationTokenSource(); ProgressDialogConfig config = new ProgressDialogConfig() .SetTitle("Uploading to Server") .SetIsDeterministic(false) .SetMaskType(MaskType.Black) .SetCancel(onCancel: cancelSrc.Cancel); using (IProgressDialog progress = UserDialogs.Instance.Progress(config)) { await DropboxServer.UploadFeedback(new System.IO.MemoryStream(Encoding.UTF8.GetBytes(returnString)), App.Database.GetLargestFeedbackID()); await Task.Delay(100); } } App.RefreshServer = true; await Navigation.PopModalAsync(); } else { await UserDialogs.Instance.AlertAsync("Please answer all questions", Title = "Error", okText : "Okay"); } }
public async Task <IActionResult> OnGetLoadCommitteeAsync(int committeeId) { var committee = await _context.Committee.FindAsync(committeeId); if (committee == null) { return(new JsonResult(false)); } return(ViewTools.GetPartialView("Partials/_CommitteeCard", committee)); }
protected async void searchInputTextChange(object sender, TextChangedEventArgs e) { int length = ViewTools.TextBoxLength(sender as TextBox); await Task.Delay(500); if (length == ViewTools.TextBoxLength(sender as TextBox)) { ProjectListLoad(); } }
// // Committee handlers: public async Task <IActionResult> OnGetEditCommittee(int committeeId) { var committee = await _context.Committee.FindAsync(committeeId); if (committee == null) { return(new JsonResult(false)); } return(ViewTools.GetPartialView("Committee/_EditCommittee", committee)); }
public override ControllerRequest View(object model) { Console.Clear(); Console.CursorVisible = false; ViewTools.Txt(top: 2, left: 3, text: "Всего хорошего, до свидания"); ViewTools.Txt(top: 3, left: 3, text: "--------------------------------------------"); ViewTools.Txt(top: 13, left: 3, text: ""); return(null); }
private void CheckUIDs(object obj) { try { var vm = viewFactory.CreateViewModel <ManageUidViewModel>(); ViewTools.ShowModalWindow <ManageUidView>(vm, Window); } catch (Exception e) { MessageBox.Show("Error occured: " + e.Message, "Easy BAML"); } }
public IActionResult OnGetCancelAddAtt(int motionId, int attType) { if (attType == 2) { return(ViewTools.GetPartialView("Att/_AddPsAttButton", motionId)); } else { return(ViewTools.GetPartialView("Att/_AddAttButton", Tuple.Create(motionId, (attType == 3 || attType == 4)))); } }
private bool?ShowSettings() { try { var settingsVM = viewFactory.CreateViewModel <SettingsViewModel>(); return(ViewTools.ShowModalWindow <SettingsView>(settingsVM, Window)); } catch (Exception e) { MessageBox.Show("Error occured: " + e.Message, "Easy BAML"); return(null); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Handle_Toggled(object sender, Xamarin.Forms.ToggledEventArgs e) { if (preparingView) { preparingView = false; return; } App.IsInNightMode = !App.IsInNightMode; ViewTools.SetStyle(App.IsInNightMode); }
private void PrepareTranslationHandler(object obj) { try { var vm = viewFactory.CreateViewModel <ManageUidViewModel>(); vm.Operation = vm.DoPrepareTranslation; ViewTools.ShowModalWindow <OperationProgressView>(vm, Window); } catch (Exception e) { MessageBox.Show("Error occured: " + e.Message, "Easy BAML"); } }
// // Att handler public async Task <IActionResult> OnGetEditAttAsync(int attId) { var att = await _context.Att .Include(a => a.Motion) .ThenInclude(m => m.Committee) .FirstOrDefaultAsync(a => a.Id == attId); if (att == null) { return(new JsonResult(false)); } return(ViewTools.GetPartialView("Att/_EditAtt", att)); }
public async Task <ActionResult> OnGetAddMotionAsync(int committeeId) { int nextNumber = 1; var lastMotion = await _context.Motion .Where(m => m.CommitteeId == committeeId) .LastOrDefaultAsync(); if (lastMotion != null) { nextNumber = lastMotion.MotionNumber + 1; } return(ViewTools.GetPartialView("Motion/_AddMotion", Tuple.Create(committeeId, nextNumber))); }
// // Motion handlers: public async Task <IActionResult> OnGetEditMotionAsync(int motionId) { var motion = await _context.Motion .Include(m => m.Committee) .Include(m => m.Att) .FirstOrDefaultAsync(m => m.Id == motionId); if (motion == null) { return(new JsonResult(false)); } return(ViewTools.GetPartialView("Motion/_EditMotion", motion)); }
public async Task <IActionResult> OnGetLoadProgramAsync(int programId) { var program = await _context.Program .Include(p => p.Section) .Include(p => p.Att) .FirstOrDefaultAsync(p => p.Id == programId); if (program == null) { return(new JsonResult(false)); } return(ViewTools.GetPartialView("_Program", program)); }
public async Task <IActionResult> OnGetCommittee(int committeeId) { var committee = await _context.Committee .Include(c => c.Motion) .ThenInclude(m => m.Att) .FirstOrDefaultAsync(c => c.Id == committeeId); if (committee == null) { return(new JsonResult(false)); } return(ViewTools.GetPartialView("_Committee", committee)); }
public override ControllerRequest View(object model) { Console.Clear(); Console.CursorVisible = false; ViewTools.Txt(top: 2, left: 3, text: "Вы хотите выйти из программы?"); ViewTools.Txt(top: 3, left: 3, text: "--------------------------------------------"); FieldList fieldList = new FieldList(); fieldList.Add(new WaitOkField(top: 5, left: 3, name: "Ok", text: "[ Ok ]")); eViewStatus viewStatus = fieldList.Input(); return(new ControllerRequest <AskToExitController>(viewStatus, fieldList.ToResultValueList())); }
public override ControllerRequest View(object model) { Console.Clear(); Console.CursorVisible = false; IPerson currentUser = ApplicationData.CurrentData.CurrentPerson; int left = 3; int top = 2; ViewTools.Txt(top: top++, left: left, text: "Список работников"); ViewTools.Txt(top: top++, left: left, text: $"Пользователь: {currentUser.FirstName}, {currentUser.LastName}"); ViewTools.Txt(top: top++, left: left, text: "--------------------------------------------"); top++; ViewTools.Txt(top: top++, left: left, text: "+------+------------------+------------------+-------------+"); ViewTools.Txt(top: top++, left: left, text: "| Id | Имя | Фамилия | Должность |"); ViewTools.Txt(top: top++, left: left, text: "+------+------------------+------------------+-------------+"); IPerson[] persons = (IPerson[])model; foreach (var person in persons.OrderBy(p => p.Role).ThenBy(p => p.LastName)) { string role = person.Role switch { Role.Worker => "Работник", Role.Manager => "Менеджер", Role.Freelancer => "Фриланстер", _ => throw new ArgumentOutOfRangeException() }; ViewTools.Txt(top: top++, left: left, text: $"| {person.Id,4} | {person.FirstName,-16} | {person.LastName,-16} | {role, -11} |"); } ViewTools.Txt(top: top++, left: left, text: "+------+------------------+------------------+-------------+"); FieldList fields = new FieldList(); top++; fields.Add(new WaitOkField(top: top++, left: left, name: "Ok", text: "[ Ok ]")); eViewStatus viewStatus = fields.Input(); return(new ControllerRequest <ManagerMainController>()); } }
private bool ConfigureSolution() { try { progressMonitor = new OperationProgressViewModel(); progressMonitor.WindowTitle = "Easy BAML - Configuring Solution"; progressMonitor.Operation = DoConfigureSolution; progressMonitor.OperationDescription = "Configuring solution projects"; ViewTools.ShowModalWindow <OperationProgressView>(progressMonitor, Window); return(true); } catch (Exception e) { MessageBox.Show("Error configuring solution: " + e.Message, "Easy BAML"); return(false); } }
public async Task <IActionResult> OnGetLoadMotionAsync(int motionId) { var motion = await _context.Motion.FindAsync(motionId); var committee = await _context.Committee .Include(c => c.Motion) .ThenInclude(m => m.Att) .FirstOrDefaultAsync(c => c.Id == motion.CommitteeId); var motionList = committee.Motion.OrderBy(m => m.MotionNumber).ToList(); var motionIndex = motionList.FindIndex(m => m.Id == motionId); if (motion == null) { return(new JsonResult(false)); } return(ViewTools.GetPartialView("_Motion", Tuple.Create(motionList, motionIndex))); }
/// <summary> /// Constructor /// </summary> public App() { InitializeComponent(); // Force database to prepare Database.Init(); // Night mode toggle if (DateTime.Now.Hour > 21 || DateTime.Now.Hour < 7) { App.IsInNightMode = true; } ViewTools.SetStyle(App.IsInNightMode); RootPage = new RootHomePage(); MainPage = RootPage; }
public override ControllerRequest View(object model) { ViewInput input = (ViewInput)model; Console.Clear(); Console.CursorVisible = false; IPerson currentUser = ApplicationData.CurrentData.CurrentPerson; FieldList fields = new FieldList(); int left = 3; int top = 2; ViewTools.Txt(top: top++, left: left, text: "Добавление нового сотрудника"); ViewTools.Txt(top: top++, left: left, text: $"Пользователь: {currentUser.FirstName}, {currentUser.LastName}"); ViewTools.Txt(top: top++, left: left, text: "--------------------------------------------"); top++; ViewTools.Txt(top: top, left: left, text: "Имя :"); fields.Add(new EditField(top: top++, left: left + 16, length: 15, name: "FirstName", text: input?.Values["FirstName"] ?? "")); ViewTools.Txt(top: top, left: left, text: "Фамилия :"); fields.Add(new EditField(top: top++, left: left + 16, length: 15, name: "LastName", text: input?.Values["LastName"] ?? "")); ViewTools.Txt(top: top, left: left, text: "Роль (1, 2, 3) :"); fields.Add(new EditField(top: top++, left: left + 16, length: 1, name: "Role", text: input?.Values["Role"] ?? "")); top++; fields.Add(new WaitOkField(top: top++, left: left, name: "Ok", text: "[ Ok ]")); if (!string.IsNullOrWhiteSpace(input?.Message)) { top++; Console.ForegroundColor = ConsoleColor.Red; ViewTools.Txt(top: top++, left: left, text: input.Message); Console.ResetColor(); } var viewStatus = fields.Input(); return(new ControllerRequest <ManagerAddNewPersonController>(viewStatus, fields.ToResultValueList())); }