protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Add our touch handlers. PinchDetector = new ScaleGestureDetector(this, this); MoveDetector = new MoveGestureDetector(this, this); RotationDetector = new RotateGestureDetector(this, this); Detector = new GestureDetector(this, this); Detector.IsLongpressEnabled = false; MainLayout = (RelativeLayout)FindViewById(Resource.Id.main); MainLayout.Touch += HandleTouch; // Disable touch handling by the views themselves. for (var i = 0; i < MainLayout.ChildCount; i++) { var view = MainLayout.GetChildAt(i); Log("OnCreate", "View {0} disabled.", i); view.Focusable = true; view.FocusableInTouchMode = true; view.RequestFocus(); } BootstrapDropbox(); }
private async void Reset_Click(object sender, EventArgs e) { imm.HideSoftInputFromWindow(Email.WindowToken, 0); MainLayout.RequestFocus(); Reset.Enabled = false; if (regsessionid != "") { string responseString = await c.MakeRequest("action=deletetemp&imageName=®sessionid=" + regsessionid); //deleting images from server if (responseString == "OK" || responseString == "INVALID_TOKEN") { if (File.Exists(regSessionFile)) { File.Delete(regSessionFile); } regsessionid = ""; ResetForm(); } else { c.ReportError(responseString); } } else { ResetForm(); } Reset.Enabled = true; }
private async void MessageSend_Click(object sender, EventArgs e) { imm.HideSoftInputFromWindow(MessageEdit.WindowToken, 0); if (MessageEdit.Text != "") { MessageSend.Enabled = false; string url = "action=reporterror&ID=" + Session.ID + "&SessionID=" + Session.SessionID; string content = "Content=" + c.UrlEncode(MessageEdit.Text + System.Environment.NewLine + "Android version: " + c.AndroidInfo() + System.Environment.NewLine + File.ReadAllText(CommonMethods.logFile)); string responseString = await c.MakeRequest(url, "POST", content); if (responseString == "OK") { MessageEdit.Text = ""; SetFormHidden(); MainLayout.RequestFocus(); c.Snack(Resource.String.SettingsSent); } else { c.ReportError(responseString); } MessageSend.Enabled = true; } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); form = new MainLayout(); Application.Run(form); }
private void HidePhaseDialog() { MainLayout.Controls.Remove(MainLayout.GetControlFromPosition(0, 0)); MainLayout.RowCount--; MainLayout.RowStyles.RemoveAt(0); }
public SalesPage() { resultsLabel = new Label { //... }; searchBar = new SearchBar { //... }; var searchLabel = new Label() { HorizontalTextAlignment = TextAlignment.Center, Text = "SearchBar", FontSize = 50, TextColor = Color.Purple }; MainLayout.Add(searchLabel); MainLayout.Add(searchBar); MainLayout.Add(resultsLabel); MainLayout.Add(searchLabel); var scrollView = new ScrollView() { Content = resultsLabel, VerticalOptions = LayoutOptions.FillAndExpand }; MainLayout.Add(scrollView); MainLayout.VerticalOptions = LayoutOptions.Start; MainLayout.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5); } }
private void MenuSelectorView_MouseClick(object sender, MouseEventArgs e) { var node = MenuSelectorView.GetNodeAt(e.Location); if (MainLayout.Controls.Count > MainLayoutCount) { MainLayout.Controls.RemoveAt(MainLayoutCount); } if (node != null && node.Text == @"Project management") { try { MainLayout.Controls.Add(pManagement); MainLayout.SetRowSpan(pManagement, 2); } catch (Exception ex) { MessageBox.Show(ex.Message); } } if (node != null && node.Text == @"Activity management") { MainLayout.Controls.Add(aManagement); MainLayout.SetRowSpan(aManagement, 2); } if (node != null && node.Text == @"Hour management") { MainLayout.Controls.Add(hManagement); MainLayout.SetRowSpan(hManagement, 2); } }
private async void MessageSend_Click(object sender, EventArgs e) { imm.HideSoftInputFromWindow(MessageEdit.WindowToken, 0); if (MessageEdit.Text != "") { MessageSend.Enabled = false; string url = "action=helpcentermessage&ID=" + Session.ID + "&SessionID=" + Session.SessionID + "&Content=" + c.UrlEncode(MessageEdit.Text); string responseString = await c.MakeRequest(url); if (responseString == "OK") { MessageEdit.Text = ""; MessageEdit.Visibility = ViewStates.Gone; MessageSend.Visibility = ViewStates.Gone; QuestionsScroll.Visibility = ViewStates.Visible; MainLayout.RequestFocus(); c.Snack(Resource.String.HelpCenterSent); } else { c.ReportError(responseString); } MessageSend.Enabled = true; } }
public void OnRelease() { if (m_DragLayout != null) { TargetInfo target = CurrentInfo.Targets.Find(e => e.type == eTutorialType.Drag); Vector3 pos = CoreUtility.WorldPositionToUIPosition(UICamera.lastWorldPosition); // Debug.Log(pos); if (DungeonInfoMenu.IsRectContainsPoint(target.pos, target.size, pos) == true) { m_DragLayout.ProcessRelease(); while (m_Prefabs.Count > 0) { Destroy(m_Prefabs[0]); m_Prefabs.RemoveAt(0); } m_DragLayout = null; SetNextTutorial(); } else { m_DragLayout.DragContainer = null; //m_DragLayout.Rebatch(); m_DragLayout.Init(TeamDataManager.Instance.GetTeam(pe_Team.Main)); m_DragLayout.ProcessRelease(); m_DragLayout = null; //TweenPosition tween = m_Prefabs[0].GetComponent<TweenPosition>(); //tween.enabled = false; //Vector3 indicator_pos = m_Prefabs[0].transform.localPosition; //m_Prefabs[0].transform.localPosition = tween.from; } } }
public MainWindows() { InitializeComponent(); //Fill the export and import checked lists chklstExport.Items.Clear(); chklstExport.Items.Add(Exp_ItemData, false); chklstExport.Items.Add(Exp_MoveData, false); chklstExport.Items.Add(Exp_PkStats, false); chklstExport.Items.Add(Exp_Text, false); chklstImport.Items.Clear(); chklstImport.Items.Add(Exp_ItemData, false); chklstImport.Items.Add(Exp_MoveData, false); chklstImport.Items.Add(Exp_PkStats, false); chklstImport.Items.Add(Exp_Text, false); //WriteExesToCWD(); txtExportPath.BackColor = COLOR_CORRECT; //By default its correct if (System.IO.Directory.Exists("./" + RomExtractSubdir)) { txtInRomPath.Text = "./" + RomExtractSubdir; txtRomPath_init = true; //We initialised it } MainLayout.Select(); }
private void TS_Elapsed(object sender, ElapsedEventArgs e) { ((Timer)sender).Stop(); this.RunOnUiThread(() => { MainScroll.FullScroll(FocusSearchDirection.Down); MainLayout.RequestFocus(); //Description text gets focus without this }); }
protected override bool OnBackButtonPressed() { base.OnBackButtonPressed(); MainLayout masterDetailPage = new MainLayout(); masterDetailPage.Detail = new NavigationPage(new MainLayoutDetail()); Application.Current.MainPage = masterDetailPage; return(true); }
private async ValueTask SetDocUrl() { if (!string.IsNullOrEmpty(FileName)) { var baseUrl = NavigationManager.ToAbsoluteUri(NavigationManager.BaseUri); var docUrl = new Uri(baseUrl, $"_content/AntDesign.Docs/docs/{FileName}.{CurrentLanguage}.json").ToString(); _file = await HttpClient.GetFromJsonAsync <DocsFile>(docUrl); _waitingHighlight = true; await MainLayout.ChangePrevNextNav(FileName); } }
public BarcodeScannerRenderer(Context context) : base(context) { MainLayout = (ConstraintLayout)LayoutInflater.FromContext(context).Inflate(Resource.Layout.BarcodeTracker, null); AddView(MainLayout); CameraSourcePreview = MainLayout.FindViewById <CameraSourcePreview>(Resource.Id.preview); CloseScannerButton = MainLayout.FindViewById <ImageButton>(Resource.Id.closeScannerBtn); CloseScannerButton.Click += async delegate { await Xamarin.Forms.Application.Current.MainPage.Navigation.PopModalAsync(); }; MGraphicOverlay = MainLayout.FindViewById <GraphicOverlay>(Resource.Id.faceOverlay); BarcodeDetector detector = new BarcodeDetector.Builder(Application.Context) .Build(); detector.SetProcessor( new MultiProcessor.Builder(new GraphicBarcodeTrackerFactory(MGraphicOverlay, this)).Build()); if (!detector.IsOperational) { // Note: The first time that an app using barcode API is installed on a device, GMS will // download a native library to the device in order to do detection. Usually this // completes before the app is run for the first time. But if that download has not yet // completed, then the above call will not detect any barcodes. // // IsOperational can be used to check if the required native library is currently // available. The detector will automatically become operational once the library // download completes on device. Android.Util.Log.Warn(TAG, "Barcode detector dependencies are not yet available."); } MCameraSource = new CameraSource.Builder(Application.Context, detector) .SetAutoFocusEnabled(true) .SetFacing(Android.Gms.Vision.CameraFacing.Back) .SetRequestedFps(15.0f) .Build(); var torchFab = FindViewById <FloatingActionButton>(Resource.Id.fab_torchlight); var hasFlashlight = Context.PackageManager.HasSystemFeature(PackageManager.FeatureCameraFlash); if (!hasFlashlight) { torchFab.Hide(); } else { torchFab.Click += TorchFab_Click; } StartCameraSource(); }
public NewMainWindow() { InitializeComponent(); utilities.WriteEmbeddedResourcesToCWD(); chklstDataSelect.Items.Clear(); chklstDataSelect.Items.Add(IO_ItemData, false); chklstDataSelect.Items.Add(IO_MoveData, false); chklstDataSelect.Items.Add(IO_PkStats, false); chklstDataSelect.Items.Add(IO_Text, false); MainLayout.Select(); //ValidateAllPaths(); }
protected override bool OnBackButtonPressed() { // Begin an asyncronous task on the UI thread because we intend to ask the users permission. //Device.BeginInvokeOnMainThread(async () => //{ // base.OnBackButtonPressed(); // await App.Navigation.PopAsync(); //}); base.OnBackButtonPressed(); MainLayout masterDetailPage = new MainLayout(); masterDetailPage.Detail = new NavigationPage(new StockLookup()); Application.Current.MainPage = masterDetailPage; return(true); }
private void SettingsFormCaption_Click(object sender, EventArgs e) { if (MessageEdit.Visibility == ViewStates.Gone) { SetFormVisible(); MessageEdit.RequestFocus(); //fullscroll page? } else { SetFormHidden(); imm.HideSoftInputFromWindow(MessageEdit.WindowToken, 0); MainLayout.RequestFocus(); } }
public Login() { InitializeComponent(); Closed += (o, e) => { if (_logined) { _main = new MainLayout() { DataContext = new LayoutViewModel() }; _main.Show(); } }; }
public bool OnScale(ScaleGestureDetector detector) { Log("OnScale", "Scaling by a factor of {0}", detector.ScaleFactor); var view = (MonkeyView)MainLayout.FindFocus(); var bounds = view.Drawable.Bounds; view.PivotX = bounds.ExactCenterX(); view.PivotY = bounds.ExactCenterY(); view.ScaleX *= detector.ScaleFactor; view.ScaleY *= detector.ScaleFactor; view.Monkey.Scale = view.ScaleX; return(true); }
void UpdateDropbox() { Log("Updating Dropbox"); var table = DropboxDatastore.GetTable("monkeys"); // Update records in local cache. if (Records.Count == 0) { for (var i = 0; i < MainLayout.ChildCount; i++) { var view = (MonkeyView)MainLayout.GetChildAt(i); var monkey = view.Monkey; monkey.Z = i; var record = table.GetOrInsert(monkey.Name, monkey.ToFields()); Records[monkey.Name] = record; } } else { for (var i = 0; i < MainLayout.ChildCount; i++) { var view = (MonkeyView)MainLayout.GetChildAt(i); var monkey = view.Monkey; monkey.Z = i; DBRecord record; var hasValue = Records.TryGetValue(monkey.Name, out record); if (hasValue) { record.SetAll(monkey.ToFields()); } else { table.GetOrInsert(monkey.Name, monkey.ToFields()); } } } if (!VerifyStore()) { RestartAuthFlow(); } else { DropboxDatastore.Sync(); } }
MonkeyView ViewRespondingToHitTest(Rect hit) { var currentView = default(MonkeyView); for (var i = MainLayout.ChildCount - 1; i > -1; i--) { var view = (MonkeyView)MainLayout.GetChildAt(i); if (IsWithinCircularBounds(hit, view.CurrentBounds)) { currentView = view; currentView.RequestFocus(); break; } } return(currentView); }
public MainPage() { InitializeComponent(); Debug.WriteLine("Initializing MAIN PAGE"); try { // Enable loading screen MainLayout.RaiseChild(LoadingView); LoadingViewEnable(); // Get water data on app start Task.Run(async() => await GetAllWaterDataOnAppStart()); } catch (Exception e) { Debug.WriteLine("Error: " + e.ToString()); } }
private void HelpCenterFormCaption_Click(object sender, EventArgs e) { if (MessageEdit.Visibility == ViewStates.Gone) { MessageEdit.Visibility = ViewStates.Visible; MessageSend.Visibility = ViewStates.Visible; QuestionsScroll.Visibility = ViewStates.Gone; MessageEdit.RequestFocus(); } else { MessageEdit.Visibility = ViewStates.Gone; MessageSend.Visibility = ViewStates.Gone; QuestionsScroll.Visibility = ViewStates.Visible; imm.HideSoftInputFromWindow(MessageEdit.WindowToken, 0); MainLayout.RequestFocus(); } }
protected override void OnLayout(bool changed, int l, int t, int r, int b) { base.OnLayout(changed, l, t, r, b); if (MainLayout != null) { var width = r - l; var height = b - t; var msw = MeasureSpec.MakeMeasureSpec(width, MeasureSpecMode.Exactly); var msh = MeasureSpec.MakeMeasureSpec(height, MeasureSpecMode.Exactly); MainLayout.Measure(msw, msh); MainLayout.Layout(0, 0, width, height); CameraSourcePreview.Layout(0, 0, width, height); //ControlsBox.Layout(0, 0, width, ); } base.OnLayout(changed, l, t, r, b); }
public MainForm() { InitializeComponent(); History = new List <BenchmarkSession>(); ViewButtons = new List <ToolStripButton>(); ViewButtons = toolStripMain.Items.OfType <ToolStripButton>().Where(x => x.CheckOnClick).ToList(); // Loggers and tracers. Logger = LogManager.GetLogger(Settings.Default.ApplicationLogger); Logger.Info(Environment.NewLine); Logger.Info("Application started..."); Trace.Listeners.Add(new Log4NetTraceListener(Settings.Default.TestLogger)); Trace.Listeners.Add(new Log4NetTraceListener(Settings.Default.TestLogger)); this.SuspendLayout(); toolStripMain.Items.Insert(toolStripMain.Items.Count - 2, new ToolStripControlHost(trackBar1)); // Layout. MainLayout = new MainLayout(dockPanel1, new ToolStripComboBox[] { cbFlowsCount, cbRecordCount }.ToList(), ViewButtons, trackBar1, CONFIGURATION_FOLDER); MainLayout.Initialize(); MainLayout.TreeView.CreateTreeView(); MainLayout.LoadDocking(); MainLayout.SelectFrame(TestMethod.Write); Manager = new ProjectManager(MainLayout); View_Click(btnSizeView, EventArgs.Empty); openFileDialogProject.InitialDirectory = CONFIGURATION_FOLDER; saveFileDialogProject.InitialDirectory = CONFIGURATION_FOLDER; WireDragDrop(Controls); this.ResumeLayout(); }
/// <summary> /// Adds a page to the <see cref="WizardPageControl"/>. Throws an exception if the given <see cref="UserControl"/> does not implement <see cref="IWizardPage"/> /// </summary> /// <param name="page"></param> /// <param name="defaultState"></param> public void Add(UserControl page, WizardNavigator.WizardNavigatorState defaultState = WizardNavigator.WizardNavigatorState.Clean) { if (!(page is IWizardPage)) { throw new ArgumentException("ERROR: Given page does not extend IWizardPage", "page"); } page.Location = new Point(0, 0); page.Top = 0; page.Left = 0; page.Visible = false; page.BackColor = Color.Transparent; page.Dock = DockStyle.Fill; MainLayout.Controls.Add(page); MainLayout.SetRow(page, 0); MainLayout.SetColumn(page, 0); pageControls.Add(page); defaultNavigatorStates.Add(pageControls.Count - 1, defaultState); ((IWizardPage)page).InvalidatePage += WizardPageControl_InvalidatePage; }
private Control GetControl(ValuePosition Pos) { switch (Pos) { case ValuePosition.Bottom: return(MainLayout.GetControlFromPosition(1, 2)); case ValuePosition.Left: return(MainLayout.GetControlFromPosition(0, 1)); case ValuePosition.LeftBottom: return(MainLayout.GetControlFromPosition(0, 2)); case ValuePosition.LeftTop: return(MainLayout.GetControlFromPosition(0, 0)); case ValuePosition.Right: return(MainLayout.GetControlFromPosition(2, 1)); case ValuePosition.RightBottom: return(MainLayout.GetControlFromPosition(2, 2)); case ValuePosition.RightTop: return(MainLayout.GetControlFromPosition(2, 0)); case ValuePosition.Top: return(MainLayout.GetControlFromPosition(1, 0)); default: return(null); } }
public void OnPress(bool isPressed) { if (CurrentInfo != null) { TargetInfo target = CurrentInfo.Targets.Find(e => e.type == eTutorialType.Drag); if (target != null) { if (string.IsNullOrEmpty(target.gameobject) == false) { GameObject target_obj = GameObject.Find(target.gameobject); if (target_obj != null) { m_DragLayout = target_obj.GetComponentInParent <MainLayout>(); if (m_DragLayout != null) { m_DragLayout.ProcessPress(); if (m_DragLayout.DragContainer == null || m_DragLayout.DragContainer.CharacterAsset.Asset.name != target.gameobject) { m_DragLayout.ProcessRelease(); m_DragLayout = null; } else { //TweenPosition tween = m_Prefabs[0].GetComponent<TweenPosition>(); //Vector3 pos = m_Prefabs[0].transform.localPosition; //tween.from = pos; //pos.x += target.drag_x; //pos.y += target.drag_y; //tween.to = pos; //tween.PlayForward(); } } } } } } }
/// <summary> /// 运行脚本 /// </summary> /// <param name="ml"></param> public static void RunScript(MainLayout ml, WriteStreamCallBack wrs, IList <IPropertyIt> propertys, WriteStreamCallBack runover = null) { ScriptObjectManager sm = new ScriptObjectManager(); if (propertys.Count > 0) { foreach (var item in propertys) { ScriptOutput so = new ScriptOutput(); so.SetValue(item.Name, item.Value); sm.SetValue(item.Id, so); } } try { IItemBox currentib = (ml.MainIb as LineItemBox).Next(0); IItemBox next = null; while (currentib != null) { ml.SetFunctionBoxRun(System.Windows.Media.Colors.Red, currentib); next = DoFunction(currentib as ItemBox, sm, wrs); ml.SetFunctionBoxStop(System.Windows.Media.Colors.White, currentib); currentib = next; } } catch (Exception ex) { wrs?.Invoke("脚本运行失败"); Log.Write(new LogMessage("脚本运行失败", ex)); } finally { sm.Dispose(); sm = null; runover?.Invoke("程序运行结束"); } }
private async void OpenTutorial_Click(object sender, EventArgs e) { MessageEdit.Visibility = ViewStates.Gone; MessageSend.Visibility = ViewStates.Gone; QuestionsScroll.Visibility = ViewStates.Visible; imm.HideSoftInputFromWindow(MessageEdit.WindowToken, 0); MainLayout.RequestFocus(); TutorialFrame.RemoveAllViews(); TutorialText.Text = ""; TutorialNavText.Text = ""; TutorialTopBar.Visibility = ViewStates.Visible; TutorialFrameBg.Visibility = ViewStates.Visible; TutorialFrame.Visibility = ViewStates.Visible; TutorialTopSeparator.Visibility = ViewStates.Visible; TutorialBottomSeparator.Visibility = ViewStates.Visible; TutorialNavBar.Visibility = ViewStates.Visible; OpenTutorial.Visibility = ViewStates.Gone; StartAnim(); cancelImageLoading = false; float width = Math.Min(dpWidth, screenHeight / pixelDensity); string url = "action=tutorial&OS=Android&dpWidth=" + width; string responseString = await c.MakeRequest(url); if (responseString.Substring(0, 2) == "OK") { tutorialDescriptions = new List <string>(); tutorialPictures = new List <string>(); responseString = responseString.Substring(3); string[] lines = responseString.Split("\t"); int count = 0; foreach (string line in lines) { count++; if (count % 2 == 1) { tutorialDescriptions.Add(line); } else { tutorialPictures.Add(line); } } currentTutorial = 0; LoadTutorial(); LoadEmptyPictures(tutorialDescriptions.Count); await Task.Run(async() => { for (int i = 0; i < tutorialDescriptions.Count; i++) { if (cancelImageLoading) { break; } await LoadPicture(i); } }); } else { c.ReportError(responseString); } }