/// <summary> /// Awake is called before Start /// </summary> void Awake() { // initialize screen and configuration utils ScreenUtils.Initialize(); ConfigurationUtils.Initialize(); EffectUtils.Initialize(); }
/// <summary> /// 绘制画布背景 /// </summary> public void Draw(ICanvas canvas, RectangleF unitrect) { try { RectangleF r = ScreenUtils.ToScreenNormalized(canvas, unitrect); //RectangleF ro = r; if (!float.IsNaN(r.X) || !float.IsInfinity(r.X) || !float.IsNaN(r.Y) || !float.IsInfinity(r.Y) || !float.IsNaN(r.Width) || !float.IsInfinity(r.Width) || !float.IsNaN(r.Height) || !float.IsInfinity(r.Height)) { canvas.Graphics.FillRectangle(m_backgroundBrush, r); } //绘制东南西北 //Image img_coording = global::Canvas.Properties.Resources.timg; //if (img_coording != null) //{ // Rectangle rt = new Rectangle((int)ro.X + 15, (int)ro.Y + 10, 150, 150); // canvas.Graphics.DrawImage(img_coording, rt); //} canvas.Graphics.ResetTransform(); } catch (Exception ex) { throw ex; } }
protected void edValue_InternalFieldsNeeded(object sender, PXCallBackEventArgs e) { List <string> res = new List <string>(); SYExportMaint graph = (SYExportMaint)this.ds.DataGraph; if (graph.Mappings.Current == null || string.IsNullOrEmpty(graph.Mappings.Current.ScreenID)) { return; } PXSiteMap.ScreenInfo info = ScreenUtils.GetScreenInfo(graph.Mappings.Current.ScreenID); Dictionary <string, bool> addedViews = new Dictionary <string, bool>(); foreach (string viewname in info.Containers.Keys) { int index = viewname.IndexOf(": "); if (index != -1 && addedViews.ContainsKey(viewname.Substring(0, index))) { continue; } addedViews.Add(viewname, true); foreach (PX.Data.Description.FieldInfo field in info.Containers[viewname].Fields) { res.Add("[" + viewname + "." + field.FieldName + "]"); } } e.Result = string.Join(";", res.ToArray()); }
public PageFactory(Context context, string bookId, List <BookMixAToc.MixToc.Chapters> chaptersList) : this(context, ScreenUtils.getScreenWidth(), ScreenUtils.getScreenHeight(), //Settings.GetFontSize(bookId), Settings.FontSize, bookId, chaptersList) { }
public override string ToString() { if (Camera.main == null || gameObject == null || !gameObject.activeInHierarchy || Hp <= 0) { return(string.Empty); } Vector2 enemyPos = ScreenUtils.WorldToScreenPoint(Camera.main, gameObject.transform, Vector2.zero); enemyPos.y = Screen.height - enemyPos.y; int x = (int)enemyPos.x; int y = (int)enemyPos.y; List <string> result = new(); if (ConfigManager.ShowEnemyHp && ScreenUtils.InsideOfScreen(x, y)) { result.Add($"{x}|{y}|{Hp}"); y += 23; } if (ConfigManager.ShowEnemyPosition && ScreenUtils.InsideOfScreen(x, y)) { result.Add($"{x}|{y}|{gameObject.transform.position.ToSimpleString(ConfigManager.PositionPrecision)}"); y += 23; } if (ConfigManager.ShowEnemyVelocity && rigidbody2D != null && ScreenUtils.InsideOfScreen(x, y)) { result.Add($"{x}|{y}|{rigidbody2D.velocity.ToSimpleString(ConfigManager.VelocityPrecision)}"); } return(StringUtils.Join("|", result)); }
/// <summary> /// Awake is called before Start /// </summary> void Awake() { // initialize screen utils MenuManager.RegisterAsGameOverListener(); ScreenUtils.Initialize(); ConfigurationUtils.Initialize(); }
/// <summary> /// /// </summary> /// <param name="posList"></param> /// <param name="mediator"></param> /// <param name="launchedFromInsertMenu"></param> /// <param name="subItemOwner"></param> public void SetDlginfo(ICmPossibilityList posList, Mediator mediator, bool launchedFromInsertMenu, IPartOfSpeech subItemOwner) { CheckDisposed(); m_subItemOwner = subItemOwner; // May be null, which is fine. m_posList = posList; m_launchedFromInsertMenu = launchedFromInsertMenu; m_mediator = mediator; if (mediator != null) { // Reset window location. // Get location to the stored values, if any. object locWnd = m_mediator.PropertyTable.GetValue("masterCatListDlgLocation"); object szWnd = m_mediator.PropertyTable.GetValue("masterCatListDlgSize"); if (locWnd != null && szWnd != null) { Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd); ScreenUtils.EnsureVisibleRect(ref rect); DesktopBounds = rect; StartPosition = FormStartPosition.Manual; } } Debug.Assert(posList != null); m_cache = posList.Cache; LoadMasterCategories(posList.ReallyReallyAllPossibilities); }
/// <summary> /// Awake is called before Start /// </summary> void Awake() { // initialize screen utils ScreenUtils.Initialize(); ConfigurationUtils.Initialize(); }
public LiveChannelPage() { this.InitializeComponent(); _listFactory = new LiveListFactory(); _listFactory.HttpSucessHandler += listFactory_HttpSucessed; _listFactory.HttpFailorTimeOut += http_FailorTimeOut; _sportsFactory = new LiveCenterSportsFactory(); _sportsFactory.HttpSucessHandler += liveCenter_HttpSucessed; _sportsFactory.HttpFailorTimeOut += http_FailorTimeOut; _gamesFactory = new LiveCenterGameFacotry(); _gamesFactory.HttpSucessHandler += liveCenter_HttpSucessed; _gamesFactory.HttpFailorTimeOut += http_FailorTimeOut; _viewModel = new LiveListViewModel(); _viewModel.Groups = new ObservableCollection <LiveListGroup>(); this.DefaultViewModel["LiveChannels"] = _viewModel.Groups; _liveCenterViewModel = new ObservableCollection <LiveListGroup>(); this.DefaultViewModel["LiveCenterSource"] = _liveCenterViewModel; _colCount = ScreenUtils.CreateColNum(119, 260); var gridHeight = 129 * _colCount + 30; satelliteGridView.MaxHeight = gridHeight; localtvGridView.MaxHeight = gridHeight; livecenterGridView.MaxHeight = gridHeight + 60; RequestDatas(); }
public override string RenderValue() { NicheType NicheType = ScreenUtils.GetSelectedNiche(Q); IndustryType IndustryType = Markets.GetIndustry(NicheType, Q); return(Visuals.Link("Is part of " + Enums.GetFormattedIndustryName(IndustryType) + " industry")); }
protected override void OnDestroy() { base.OnDestroy(); //if (mTtsPlayer.getPlayerState() == TTSCommonPlayer.PLAYER_STATE_PLAYING) // mTtsPlayer.stop(); EventManager.refreshCollectionIcon(); EventManager.refreshCollectionList(); MessageBus.Default.DeRegister <DownloadProgress>(showDownProgress); MessageBus.Default.DeRegister <DownloadMessage>(downloadMessage); try { UnregisterReceiver(receiver); } catch (Exception e) { LogUtils.e("Receiver not registered"); } if (isAutoLightness) { ScreenUtils.startAutoBrightness(this); } else { ScreenUtils.stopAutoBrightness(this); } }
public void move() { this.velocity -= this.gravity; this.velocity *= 0.4f; this.y += this.velocity; // Keep it stuck to top or bottom float height = -ScreenUtils.GetWorldScreenSize().y / 2f; if (this.y < height) { this.y = height; this.velocity = 0f; } if (this.y > 5f) { this.y = 5f; this.velocity = 0f; } Vector3 pos = gameObject.transform.localPosition; pos.y = this.y; gameObject.transform.localPosition = pos; // Every frame it is alive increases the score this.score++; }
private void UpdateTripleScreenUI() { screenPanel.Visibility = isTripleScreen ? Visibility.Visible : Visibility.Collapsed; if (Selection == null) { return; } holdScreenEvent = true; switch (ScreenUtils.GetScreen(Selection)) { case ScreenPositionType.LEFT: screenLeftRadio.IsChecked = true; break; case ScreenPositionType.CENTER: screenCenterRadio.IsChecked = true; break; case ScreenPositionType.RIGHT: screenRightRadio.IsChecked = true; break; case ScreenPositionType.OUTSIDE: screenRightRadio.IsChecked = screenCenterRadio.IsChecked = screenLeftRadio.IsChecked = false; break; } holdScreenEvent = false; }
public override void configViews() { hideStatusBar(); decodeView = Window.DecorView; RelativeLayout.LayoutParams @params = (RelativeLayout.LayoutParams)mLlBookReadTop.LayoutParameters; @params.TopMargin = ScreenUtils.getStatusBarHeight(this) - 2; mLlBookReadTop.LayoutParameters = @params; initTocList(); initAASet(); initPagerWidget(); // 本地收藏 直接打开 if (isFromSD) { BookMixAToc.MixToc.Chapters chapters = new BookMixAToc.MixToc.Chapters(); chapters.title = recommendBooks.title; mChapterList.Add(chapters); showChapterRead(null, currentChapter); //本地书籍隐藏社区、简介、缓存按钮 gone(mTvBookReadCommunity, mTvBookReadChangeSource, mTvBookReadDownload); return; } getBookMixAToc(bookId, "chapters"); }
public RectangleF GetBoundingRect(ICanvas canvas) { try { float thWidth = LineTool.ThresholdWidth(canvas, Width, ThresholdPixel); if (thWidth < Width) { thWidth = Width; } RectangleF rect = RectangleF.Empty; if (m_p2.IsEmpty || m_p3.IsEmpty) { rect = ScreenUtils.GetRect(m_p1, m_lastPoint, thWidth); } if (rect.IsEmpty) { float r = m_radius + thWidth / 2; rect = HitUtil.CircleBoundingRect(m_center, r); if (Selected) { float w = (float)canvas.ToUnit(20); rect.Inflate(w, w); } } if (m_lastPoint.IsEmpty == false) { rect = RectangleF.Union(rect, new RectangleF(m_lastPoint.Point, new SizeF(0, 0))); } return(rect); } catch (Exception ex) { throw ex; } }
/// <summary> /// Awake is called before Start /// </summary> void Awake() { // initialize screen utils //AudioManager.Play(AudioClipName.BallSpawned); ScreenUtils.Initialize(); Globals.Initialize(); }
public void ScreensChanged_ShouldFireAndResolutionShowMatchChange_WhenScreenResolutionChanges() { var manager = new ScreenManager(); var hasChanged = false; IReadOnlyCollection <IScreen> updatedScreens = null; manager.Changed += (sender, args) => { hasChanged = true; updatedScreens = args.Screens; }; var primaryScreen = manager.GetAll().Single(screen => screen.IsPrimary); var displayName = primaryScreen.Name; var oldResolution = primaryScreen.Resolution; var newResolution = primaryScreen.GetResolutions().OrderByDescending(screen => screen).Skip(1).FirstOrDefault(); _output.WriteLine("Changing resolution to: " + newResolution); ScreenUtils.ChangeResolution(displayName, newResolution); Thread.Sleep(1000); hasChanged.ShouldBeTrue(); updatedScreens.ShouldNotBeNull(); updatedScreens.ShouldContain(screen => screen.IsPrimary && screen.Resolution == newResolution, 1); _output.WriteLine("Changing resolution back to: " + oldResolution); ScreenUtils.ChangeResolution(displayName, oldResolution); }
public void SetParams(string adsId, int adsLimited) { this.isTablet = ScreenUtils.CanFitTabletBanner(); this.config = this.LoadDefaultConfig(); this.adsUrlQueue = this.PrepareAdsUrlQueue(adsId, adsLimited); this.rewardInfo = RewardEventData.LoadEventData(); }
public DictionaryConfigurationDlg(Mediator mediator) { m_mediator = mediator; InitializeComponent(); m_preview.Dock = DockStyle.Fill; m_preview.Location = new Point(0, 0); previewDetailSplit.Panel1.Controls.Add(m_preview); manageConfigs_treeDetailButton_split.IsSplitterFixed = true; treeDetail_Button_Split.IsSplitterFixed = true; this.MinimumSize = new Size(m_grpConfigurationManagement.Width + 3, manageConfigs_treeDetailButton_split.Height); m_helpTopicProvider = mediator.HelpTopicProvider; m_helpProvider = new HelpProvider { HelpNamespace = m_helpTopicProvider.HelpFile }; m_helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(HelpTopic)); m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic); m_helpProvider.SetShowHelp(this, true); // Restore the location and size from last time we called this dialog. if (m_mediator != null && m_mediator.PropertyTable != null) { object locWnd = m_mediator.PropertyTable.GetValue("DictionaryConfigurationDlg_Location"); object szWnd = m_mediator.PropertyTable.GetValue("DictionaryConfigurationDlg_Size"); if (locWnd != null && szWnd != null) { Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd); ScreenUtils.EnsureVisibleRect(ref rect); DesktopBounds = rect; StartPosition = FormStartPosition.Manual; } } }
private RectangleF GetNodeEditRectangle() { RectangleF rectangleF; float thWidth = UCCanvas.GetThresholdWidth(); if (this.currentNodeIndex == 0) { rectangleF = ScreenUtils.GetRectangleF(this.MultiLinePoints[0], this.MultiLinePoints[1], thWidth); } else if (this.currentNodeIndex == this.MultiLinePoints.Count - 1) { rectangleF = ScreenUtils.GetRectangleF(this.MultiLinePoints[this.MultiLinePoints.Count - 2], this.MultiLinePoints[this.MultiLinePoints.Count - 1], thWidth); } else { List <UnitPoint> temp = new List <UnitPoint>(); temp.Add(this.MultiLinePoints[this.currentNodeIndex - 1]); temp.Add(this.MultiLinePoints[this.currentNodeIndex]); temp.Add(this.MultiLinePoints[this.currentNodeIndex + 1]); float maxX = (float)temp.Max <UnitPoint>(maxx => maxx.X); float maxY = (float)temp.Max <UnitPoint>(maxy => maxy.Y); float minX = (float)temp.Min <UnitPoint>(minx => minx.X); float minY = (float)temp.Min <UnitPoint>(miny => miny.Y); rectangleF = ScreenUtils.GetRectangleF(new UnitPoint(minX, minY), new UnitPoint(maxX, maxY), thWidth); } return(rectangleF); }
void Render() { var industry = ScreenUtils.GetSelectedIndustry(Q); var niches = Markets.GetObservableNichesInIndustry(industry, Q); GetComponent <NicheListView>().SetItems(niches); }
public PersonalCenter() { this.InitializeComponent(); _colNum = ScreenUtils.CreateColNum(160, 291); if (_isDownloading) { toggleDownloading_Click(this, null); } else { toggleDownloaded_Click(this, null); } if (PersonalFactory.Instance.Logined) { LayoutContent.Visibility = Visibility.Visible; loginButton.Visibility = Visibility.Collapsed; LayoutContent.DataContext = PersonalFactory.Instance.DataInfos[0].UserStateInfo; } else { loginButton.Visibility = Visibility.Visible; LayoutContent.Visibility = Visibility.Collapsed; } DownPathSelected(); }
public static Bitmap getThemeDrawable(int theme) { Bitmap bmp = Bitmap.CreateBitmap(ScreenUtils.getScreenWidth(), ScreenUtils.getScreenHeight(), Bitmap.Config.Argb8888); switch (theme) { case NORMAL: bmp.EraseColor(ContextCompat.GetColor(AppUtils.getAppContext(), Resource.Color.read_theme_white)); break; case YELLOW: bmp.EraseColor(ContextCompat.GetColor(AppUtils.getAppContext(), Resource.Color.read_theme_yellow)); break; case GREEN: bmp.EraseColor(ContextCompat.GetColor(AppUtils.getAppContext(), Resource.Color.read_theme_green)); break; case LEATHER: bmp = BitmapFactory.DecodeResource(AppUtils.getAppContext().Resources, Resource.Drawable.theme_leather_bg); break; case GRAY: bmp.EraseColor(ContextCompat.GetColor(AppUtils.getAppContext(), Resource.Color.read_theme_gray)); break; case NIGHT: bmp.EraseColor(ContextCompat.GetColor(AppUtils.getAppContext(), Resource.Color.read_theme_night)); break; default: break; } return(bmp); }
public override void ViewRender() { base.ViewRender(); var shareholder = ScreenUtils.GetSelectedInvestor(Q); if (shareholder == null) { return; } var investorId = shareholder.shareholder.Id; var company = SelectedCompany; SharesInfo.text = shareholder.shareholder.Name + " owns " + Companies.GetShareSize(Q, company, shareholder) + "% of company"; var shareCost = Companies.GetSharesCost(Q, company, shareholder); Valuation.text = Format.Money(shareCost); Offer.text = Format.Money(shareCost); CompanyName.text = $"Buy shares of company {SelectedCompany.company.Name}"; ProposalStatus.text = true ? Visuals.Positive("They will accept our offer!") : Visuals.Negative("They will decline: Wants more money"); BuyShares.ShareholderId = investorId; CanBuySharesController.Render(investorId); }
public FirstPage() { this.InitializeComponent(); this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled; ChannelTypeFactory.Instance.HttpFailorTimeOut += http_FailorTimeOut; this.DefaultViewModel["ChannelTypes"] = ChannelTypeFactory.Instance.SelectedViewModel; _recommendChannelViewModel = new ChannelRecommendViewModel(); _recommendChannelViewModel.Groups = new ObservableCollection <ChannelRecommendGroup>(); this.DefaultViewModel["ChannelLists"] = _recommendChannelViewModel.Groups; _recommendNavFactory = new RecommendNavFactory(); _recommendNavFactory.HttpSucessHandler += recommandNav_Successed; _recommendNavFactory.HttpFailorTimeOut += http_FailorTimeOut; LocalRecentFactory.Instance.LocalChangeAction += LoadRecentDatas; LocalFavoritesFactory.Instance.LocalChangeAction += LoadFavDatas; _cloudRecentGetFactory = new CloudGetFactory(); _cloudRecentGetFactory.HttpSucessHandler += cloudRecentGetFactory_HttpSucess; _cloudFavolitenGetFactory = new CloudGetFactory(); _cloudFavolitenGetFactory.HttpSucessHandler += cloudFavolitenGetFactory_HttpSucess; var colCount = ScreenUtils.CreateColNum(160, 255); _recCount = colCount * 3; var channelTypeHeight = (180 * colCount) + 50; ChannelTypeFactory.Instance.ColNumber = channelTypeHeight / 130; channelTypeGridView.MaxHeight = channelTypeHeight; slidesShowControl.Init(http_FailorTimeOut); }
/// <summary> /// Awake is called before Start /// </summary> void Awake() { ConfigurationUtils.Initialize(); ScreenUtils.Initialize(); EffectUtils.Initialize(); EventManager.Initialize(); }
public void OnLoadContentEvent(MPP.core2d.GameScreenManager.LoadContentEventArgs eventArgs) { background = ScreenUtils.GetTexture("mainMenuBackground"); buttons = new core2d.AnimatedButton[2]; buttons[0] = new AnimatedButton(MenuScreen.START_A_NEW_GAME_BUTTON_LABEL); SetNewGameButtonLabel(); buttons[1] = new AnimatedButton(MenuScreen.SOUND_SETTINGS_BUTTON_LABEL); SetSoundButtonLabel(); /* * buttons[2] = new AnimatedButton(MenuScreen.HELP_BUTTON_LABEL); * buttons[2].SetLabel(Constans.MENU_SELECTED_BUTTON_BACKGROUND_COLOR, Constans.MENU_NON_SELECTED_BUTTON_BACKGROUND_COLOR, Constans.MENU_NON_SELECTED_BUTTON_BACKGROUND_COLOR, * Constans.MENU_NON_ACTIVE_TEXT_COLOR, Constans.MENU_FONT_NAME, * ResourceManager.Instance.GetString(ResourceManager.StringKey.HELP), * Constans.STANDARD_BUTTON_WIDTH, Constans.STANDARD_BUTTON_HEIGHT); */ for (int i = 0; i < buttons.Length; i++) { buttons[i].ButtonPressedListener += this.OnButtonPressed; buttons[i].ButtonTransitionListener += this.OnButtonTransition; transitionButtonCountdown = 0; } }
public override void setData(DiscussionList.PostsBean item) { if (!Settings.IsNoneCover) { holder.setCircleImageUrl(Resource.Id.ivBookCover, Constant.IMG_BASE_URL + item.author.avatar, Resource.Drawable.avatar_default); } else { holder.setImageResource(Resource.Id.ivBookCover, Resource.Drawable.avatar_default); } holder.setText(Resource.Id.tvBookTitle, item.author.nickname) .setText(Resource.Id.tvBookType, Java.Lang.String.Format(mContext.GetString(Resource.String.book_detail_user_lv), item.author.lv)) .setText(Resource.Id.tvTitle, item.title) .setText(Resource.Id.tvHelpfulYes, item.commentCount + "") .setText(Resource.Id.tvLikeCount, item.likeCount + ""); try { TextView textView = holder.getView <TextView>(Resource.Id.tvHelpfulYes); if (item.type.Equals("vote")) { Drawable drawable = ContextCompat.GetDrawable(mContext, Resource.Drawable.ic_notif_vote); drawable.SetBounds(0, 0, ScreenUtils.dpToPxInt(15), ScreenUtils.dpToPxInt(15)); textView.SetCompoundDrawables(drawable, null, null, null); } else { Drawable drawable = ContextCompat.GetDrawable(mContext, Resource.Drawable.ic_notif_post); drawable.SetBounds(0, 0, ScreenUtils.dpToPxInt(15), ScreenUtils.dpToPxInt(15)); textView.SetCompoundDrawables(drawable, null, null, null); } if (TextUtils.Equals(item.state, "hot")) { holder.setVisible(Resource.Id.tvHot, true); holder.setVisible(Resource.Id.tvTime, false); holder.setVisible(Resource.Id.tvDistillate, false); } else if (TextUtils.Equals(item.state, "distillate")) { holder.setVisible(Resource.Id.tvDistillate, true); holder.setVisible(Resource.Id.tvHot, false); holder.setVisible(Resource.Id.tvTime, false); } else { holder.setVisible(Resource.Id.tvTime, true); holder.setVisible(Resource.Id.tvHot, false); holder.setVisible(Resource.Id.tvDistillate, false); holder.setText(Resource.Id.tvTime, FormatUtils.getDescriptionTimeFromDateString(item.created)); } } catch (Exception e) { LogUtils.e(e.ToString()); } }
/// <summary> /// Awake is called before Start /// </summary> void Start() { // initialize screen and configuration utils EventManager.Initialize(); ScreenUtils.Initialize(); GameUtils.Initialize(); ConfigurationUtils.Initialize(); }
private void Awake() { ScreenUtils.Initialize(); Debug.Log("Left" + ScreenUtils.ScreenLeft); Debug.Log("Right" + ScreenUtils.ScreenRight); Debug.Log("Top" + ScreenUtils.ScreenTop); Debug.Log("Bottom" + ScreenUtils.ScreenBottom); }
public void OpenMakeList(object sender, EventArgs e) { UIButton btnMakeSearch = (UIButton)sender; ScreenUtils scnUtils = new ScreenUtils (); scnUtils.GetAbsolutePosition (btnMakeSearch); float iTop = scnUtils.GetPositionTop (); float iLeft = scnUtils.GetPositionLeft (); int iBtnTagId = btnMakeSearch.Tag; int iPwrIdRow = iBtnTagId / iEquipmentMakeSearchTagId; int iStringRow = iBtnTagId - (iPwrIdRow * iEquipmentMakeSearchTagId); int iSectionCounterTagId = iEquipmentRowSectionCounterTagId * iPwrIdRow + iStringRow; UILabel hfSectionCounter = (UILabel)View.ViewWithTag (iSectionCounterTagId); int iSectionCounterId = Convert.ToInt32(hfSectionCounter.Text); //Create a list and convert the string array to the list. Why the system cannot take a simple string arary is beyond me!!! UILabel lblEquipmentType = (UILabel)View.ViewWithTag (iEquipmentTypeTagId * (iPwrIdRow) + (iStringRow)); int iEquipmentType = Convert.ToInt32(lblEquipmentType.Text); List<string> mylist = new List<string> (); clsTabletDB.ITPInventory ITPInventory = new clsTabletDB.ITPInventory (); string[] sMakes; switch(iEquipmentType) { case 3: sMakes = ITPInventory.GetRackMakes (); m_sRackMakes = sMakes; Array.ForEach (m_sRackMakes, value => mylist.Add (value.ToString ())); break; case 4: sMakes = ITPInventory.GetSubRackMakes (); m_sSubRackMakes = sMakes; Array.ForEach (m_sSubRackMakes, value => mylist.Add (value.ToString ())); break; case 5: sMakes = ITPInventory.GetPositionMakes (); m_sPositionMakes = sMakes; Array.ForEach (m_sPositionMakes, value => mylist.Add (value.ToString ())); break; case 7: sMakes = ITPInventory.GetSolarStringMakes (); m_sSolarStringMakes = sMakes; Array.ForEach (m_sSolarStringMakes, value => mylist.Add (value.ToString ())); break; default: sMakes = ITPInventory.GetPositionMakes (); m_sPositionMakes = sMakes; Array.ForEach (m_sPositionMakes, value => mylist.Add (value.ToString ())); break; } TableViewSource tabdata = new TableViewSource (mylist, true); tabdata.SetFont("Verdana",10f); UITableView cmbMake = new UITableView (); //If the bottom of the frame would be outside the main content frame make it go upwards instead of downwards UILabel hfContentHeight = (UILabel)View.ViewWithTag (3); int iContentHeight = Convert.ToInt32 (hfContentHeight.Text); if (iTop + 190f > (float)iContentHeight) { cmbMake.Frame = new RectangleF(iLeft, iTop - 190f, 290f, 200f); } else { cmbMake.Frame = new RectangleF(iLeft, iTop, 290f, 200f); } tabdata.SetParent(cmbMake); tabdata.SetUpdateFieldType("UILabel"); UILabel txtVwUpdate = (UILabel)View.ViewWithTag (iEquipmentMakeTagId * (iPwrIdRow) + (iStringRow)); tabdata.SetLabelViewToUpdate(txtVwUpdate); UIView vwUnsaved = (UIView)View.ViewWithTag (60); tabdata.SetUnsavedChangesView(vwUnsaved); tabdata.SetShowUnsavedOnChange(true); //Also set the section flag to 1 that it has changed and the overall flag that it has changed UILabel lblUnsavedFlag = (UILabel)View.ViewWithTag (80); tabdata.SetUnsavedChangesHiddenLabel(lblUnsavedFlag); UIButton btnSectionSave = (UIButton)View.ViewWithTag ((iSectionCounterId + 1) * iSaveSectionBtnTagId); tabdata.SetSectionSaveButton(btnSectionSave); UILabel lblUnsavedSectionFlag = (UILabel)View.ViewWithTag ((iSectionCounterId + 1) * iSectionStatusTagId); tabdata.SetUnsavedChangesSectionHiddenLabel(lblUnsavedSectionFlag); UILabel lblViewModel = (UILabel)View.ViewWithTag (iEquipmentModelTagId * (iPwrIdRow) + (iStringRow)); tabdata.SetMakePostUpdate(1, lblViewModel); cmbMake.Source = tabdata; iUtils.SESTable thistable = new iUtils.SESTable(); string sSelectedValue = txtVwUpdate.Text; switch(iEquipmentType) { case 3: thistable.SetTableSelectedText(cmbMake, sSelectedValue, m_sRackMakes, true); break; case 4: thistable.SetTableSelectedText(cmbMake, sSelectedValue, m_sSubRackMakes, true); break; case 5: thistable.SetTableSelectedText(cmbMake, sSelectedValue, m_sPositionMakes, true); break; case 7: thistable.SetTableSelectedText(cmbMake, sSelectedValue, m_sSolarStringMakes, true); break; default: thistable.SetTableSelectedText(cmbMake, sSelectedValue, m_sPositionMakes, true); break; } //Get the main scroll view UIScrollView scrollVw = (UIScrollView)View.ViewWithTag (2); scrollVw.AddSubview(cmbMake); }
public void OpenITP(object sender, EventArgs e) { //Show the progress indicator and position at top left of button UIButton btnOpen = (UIButton)sender; prog.SetActivityIndicatorTitle("Opening ITP"); ScreenUtils scnUtils = new ScreenUtils(); scnUtils.GetAbsolutePosition(btnOpen); UIScrollView scrollVw = (UIScrollView)View.ViewWithTag (2); PointF layoutOffset = scrollVw.ContentOffset; float iVertOffset = layoutOffset.Y; float iTop = scnUtils.GetPositionTop() - iVertOffset; float iLeft = scnUtils.GetPositionLeft(); prog.SetActivityIndicatorPosition(iLeft,iTop); prog.ShowActivityIndicator(); prog.StartAnimating(); //Disable all other buttons DisableButtons(); taskA = new Task (() => OpenITPTask (sender, e)); taskA.Start (); }
public void OpenModelList(object sender, EventArgs e) { UIButton btnModelSearch = (UIButton)sender; ScreenUtils scnUtils = new ScreenUtils (); scnUtils.GetAbsolutePosition (btnModelSearch); float iTop = scnUtils.GetPositionTop (); float iLeft = scnUtils.GetPositionLeft (); int iBtnTagId = btnModelSearch.Tag; int iPwrIdRow = iBtnTagId / iEquipmentModelSearchTagId; int iStringRow = iBtnTagId - (iPwrIdRow * iEquipmentModelSearchTagId); int iSectionCounterTagId = iEquipmentRowSectionCounterTagId * iPwrIdRow + iStringRow; UILabel hfSectionCounter = (UILabel)View.ViewWithTag (iSectionCounterTagId); int iSectionCounterId = Convert.ToInt32 (hfSectionCounter.Text); UILabel lblSupplier = (UILabel)View.ViewWithTag (iEquipmentMakeTagId * (iPwrIdRow) + (iStringRow)); string sSupplier = lblSupplier.Text; if (sSupplier == "") { iUtils.AlertBox alert = new iUtils.AlertBox (); alert.CreateErrorAlertDialog ("You must select a make before you can select a model"); return; } UILabel lblEquipmentType = (UILabel)View.ViewWithTag (iEquipmentTypeTagId * (iPwrIdRow) + (iStringRow)); int iEquipmentType = Convert.ToInt32(lblEquipmentType.Text); //Create a list and convert the string array to the list. Why the system cannot take a simple string array is beyond me!!! List<string> listModel = new List<string> (); clsTabletDB.ITPInventory ITPInventory = new clsTabletDB.ITPInventory (); string[] sModels; switch(iEquipmentType) { case 3: sModels = ITPInventory.GetRackModels (sSupplier); m_sRackModels = sModels; Array.ForEach (m_sRackModels, value => listModel.Add (value.ToString ())); break; case 4: sModels = ITPInventory.GetSubRackModels (sSupplier); m_sSubRackModels = sModels; Array.ForEach (m_sSubRackModels, value => listModel.Add (value.ToString ())); break; case 5: sModels = ITPInventory.GetPositionModels (sSupplier); m_sPositionModels = sModels; Array.ForEach (m_sPositionModels, value => listModel.Add (value.ToString ())); break; case 7: sModels = ITPInventory.GetSolarStringModels (sSupplier); m_sSolarStringModels = sModels; Array.ForEach (m_sSolarStringModels, value => listModel.Add (value.ToString ())); break; default: sModels = ITPInventory.GetPositionModels (sSupplier); m_sPositionModels = sModels; Array.ForEach (m_sPositionModels, value => listModel.Add (value.ToString ())); break; } TableViewSource tabdata = new TableViewSource (listModel, true); tabdata.SetFont("Verdana",10f); UITableView cmbModel = new UITableView (); //If the bottom of the frame would be outside the main content frame make it go upwards instead of downwards UILabel hfContentHeight = (UILabel)View.ViewWithTag (3); int iContentHeight = Convert.ToInt32 (hfContentHeight.Text); if (iTop + 190f > (float)iContentHeight) { if (iLeft + 290f > 1000f) { cmbModel.Frame = new RectangleF(iLeft - 300f, iTop - 190f, 290f, 200f); } else { cmbModel.Frame = new RectangleF(iLeft, iTop - 190f, 290f, 200f); } } else { if (iLeft + 290f > 1000f) { cmbModel.Frame = new RectangleF(iLeft - 300f, iTop, 290f, 200f); } else { cmbModel.Frame = new RectangleF(iLeft, iTop, 290f, 200f); } } tabdata.SetParent(cmbModel); tabdata.SetUpdateFieldType("UILabel"); UILabel lblVwUpdate = (UILabel)View.ViewWithTag (iEquipmentModelTagId * (iPwrIdRow) + (iStringRow)); tabdata.SetLabelViewToUpdate(lblVwUpdate); UIView vwUnsaved = (UIView)View.ViewWithTag (60); tabdata.SetUnsavedChangesView(vwUnsaved); tabdata.SetShowUnsavedOnChange(true); UILabel hfRowStatus = (UILabel)View.ViewWithTag (iEquipmentRowStatusTagId * (iPwrIdRow) + (iStringRow)); UILabel lblSPN = (UILabel)View.ViewWithTag (iEquipmentSPNHiddenTagId * (iPwrIdRow) + (iStringRow)); tabdata.SetModelPostUpdate(6, hfRowStatus, lblSPN, sSupplier); //Here the 6 refers to the post update index and NOT batteries as the equipment type //Also set the section flag to 1 that it has changed and the overall flag that it has changed UILabel lblUnsavedFlag = (UILabel)View.ViewWithTag (80); tabdata.SetUnsavedChangesHiddenLabel(lblUnsavedFlag); UIButton btnSectionSave = (UIButton)View.ViewWithTag ((iSectionCounterId + 1) * iSaveSectionBtnTagId); tabdata.SetSectionSaveButton(btnSectionSave); UILabel lblUnsavedSectionFlag = (UILabel)View.ViewWithTag ((iSectionCounterId + 1) * iSectionStatusTagId); tabdata.SetUnsavedChangesSectionHiddenLabel(lblUnsavedSectionFlag); cmbModel.Source = tabdata; iUtils.SESTable thistable = new iUtils.SESTable(); string sSelectedValue = lblVwUpdate.Text; switch(iEquipmentType) { case 3: thistable.SetTableSelectedText(cmbModel, sSelectedValue, m_sRackModels, true); break; case 4: thistable.SetTableSelectedText(cmbModel, sSelectedValue, m_sSubRackModels, true); break; case 5: thistable.SetTableSelectedText(cmbModel, sSelectedValue, m_sPositionModels, true); break; case 7: thistable.SetTableSelectedText(cmbModel, sSelectedValue, m_sSolarStringModels, true); break; default: thistable.SetTableSelectedText(cmbModel, sSelectedValue, m_sPositionModels, true); break; } //Get the main scroll view UIScrollView scrollVw = (UIScrollView)View.ViewWithTag (2); scrollVw.AddSubview(cmbModel); }
public void OpenSearchView(object sender, EventArgs e, int iSearchType) { UIButton btnSearch = (UIButton)sender; ScreenUtils scnUtils = new ScreenUtils (); scnUtils.GetAbsolutePosition (btnSearch); float iTop = scnUtils.GetPositionTop (); float iLeft = scnUtils.GetPositionLeft (); int iBtnTagId = btnSearch.Tag; int iSearchTagTypeId = -1; string sType = ""; bool bBuildSearchView = false; switch (iSearchType) { case 1: //Floor iSearchTagTypeId = iEquipmentFloorSearchTagId; sType = "floor"; break; case 2: //Suite iSearchTagTypeId = iEquipmentSuiteSearchTagId; sType = "suite"; break; case 3: //Rack iSearchTagTypeId = iEquipmentRackSearchTagId; sType = "rack"; break; case 4: //SubRack iSearchTagTypeId = iEquipmentSubRackSearchTagId; sType = "subrack"; break; case 5: //Position iSearchTagTypeId = iEquipmentPositionSearchTagId; sType = "position"; break; case 7: //String iSearchTagTypeId = iEquipmentStringSearchTagId; sType = "solar string"; break; } int iPwrIdRow = iBtnTagId / iSearchTagTypeId; int iStringRow = iBtnTagId - (iPwrIdRow * iSearchTagTypeId); int iSectionCounterTagId = iEquipmentRowSectionCounterTagId * iPwrIdRow + iStringRow; UILabel hfSectionCounter = (UILabel)View.ViewWithTag (iSectionCounterTagId); int iSectionCounterId = Convert.ToInt32 (hfSectionCounter.Text); //Now show the search box and button if (m_vwSearch == null) { UIView vwSearch = new UIView (); m_vwSearch = vwSearch; bBuildSearchView = true; } //If the bottom of the frame would be outside the main content frame make it go upwards instead of downwards UILabel hfContentHeight = (UILabel)View.ViewWithTag (3); int iContentHeight = Convert.ToInt32 (hfContentHeight.Text); if (iTop + 190f > (float)iContentHeight) { m_vwSearch.Frame = new RectangleF (iLeft, iTop - 190f, 400f, 300f); } else { m_vwSearch.Frame = new RectangleF (iLeft, iTop, 400f, 300f); } m_vwSearch.Layer.BorderWidth = 1f; m_vwSearch.BackgroundColor = UIColor.FromRGBA (238, 238, 238, 255); if (bBuildSearchView) { UILabel lblSearch = new UILabel (); lblSearch.Frame = new RectangleF (2f, 2f, 396f, 40f); lblSearch.Text = "Show " + sType + " items containing :"; lblSearch.BackgroundColor = UIColor.FromRGBA (238, 238, 238, 255); lblSearch.Tag = iSearchLabelTagId; m_vwSearch.AddSubview (lblSearch); UILabel hfSearch = new UILabel (); hfSearch.Text = iSearchType.ToString(); hfSearch.Tag = iSearchHiddenLabelTagId; hfSearch.Hidden = true; m_vwSearch.AddSubview (hfSearch); UILabel hfPwrIdRow = new UILabel (); hfPwrIdRow.Text = iPwrIdRow.ToString(); hfPwrIdRow.Tag = iPwrIdRowHiddenLabelTagId; hfPwrIdRow.Hidden = true; m_vwSearch.AddSubview (hfPwrIdRow); UILabel hfStringRow = new UILabel (); hfStringRow.Text = iStringRow.ToString(); hfStringRow.Tag = iStringRowHiddenLabelTagId; hfStringRow.Hidden = true; m_vwSearch.AddSubview (hfStringRow); UITextField txtSearch = new UITextField (); txtSearch.Frame = new RectangleF (2f, 44f, 198f, 40f); txtSearch.BackgroundColor = UIColor.FromRGBA (255, 255, 255, 255); txtSearch.Tag = iSearchTextTagId; txtSearch.AutocorrectionType = UITextAutocorrectionType.No; txtSearch.KeyboardType = UIKeyboardType.NumbersAndPunctuation; m_vwSearch.AddSubview (txtSearch); UIButton btnSearching = UIButton.FromType (UIButtonType.RoundedRect); btnSearching.Frame = new RectangleF (210f, 44f, 180f, 40f); btnSearching.SetTitle ("Search", UIControlState.Normal); btnSearching.Font = UIFont.FromName ("Verdana", 12f); btnSearching.Layer.BorderColor = UIColor.Black.CGColor; btnSearching.Tag = iSearchButtonTagId; m_btnSearching = btnSearching; m_btnSearching.TouchUpInside += (sender2,e2) => { OpenItemsList (sender, e, m_vwSearch,iSectionCounterId);}; } else { UIButton btnSearching = (UIButton)View.ViewWithTag (iSearchButtonTagId); UILabel lblSearching = (UILabel)View.ViewWithTag (iSearchLabelTagId); lblSearching.Text = "Show " + sType + " items containing :"; UILabel hfSearching = (UILabel)View.ViewWithTag (iSearchHiddenLabelTagId); hfSearching.Text = iSearchType.ToString(); UILabel hfPwrIdRow = (UILabel)View.ViewWithTag (iPwrIdRowHiddenLabelTagId); hfPwrIdRow.Text = iPwrIdRow.ToString(); UILabel hfStringRow = (UILabel)View.ViewWithTag (iStringRowHiddenLabelTagId); hfStringRow.Text = iStringRow.ToString(); UITextField txtSearching = (UITextField)View.ViewWithTag (iSearchTextTagId); txtSearching.Text = ""; m_btnSearching = btnSearching; m_cmbSearch.Hidden = true; } if (bBuildSearchView) { m_vwSearch.AddSubview (m_btnSearching); //Get the main scroll view UIScrollView scrollVw = (UIScrollView)View.ViewWithTag (2); scrollVw.AddSubview (m_vwSearch); } else { m_vwSearch.Hidden = false; } }
public void OpenStringList(object sender, EventArgs e) { UIButton btnBankNoSearch = (UIButton)sender; ScreenUtils scnUtils = new ScreenUtils (); scnUtils.GetAbsolutePosition (btnBankNoSearch); float iTop = scnUtils.GetPositionTop (); float iLeft = scnUtils.GetPositionLeft (); int iBtnTagId = btnBankNoSearch.Tag; int iPwrIdRow = iBtnTagId / iEquipmentStringSearchTagId; int iStringRow = iBtnTagId - (iPwrIdRow * iEquipmentStringSearchTagId); int iSectionCounterTagId = iEquipmentRowSectionCounterTagId * iPwrIdRow + iStringRow; UILabel hfSectionCounter = (UILabel)View.ViewWithTag (iSectionCounterTagId); int iSectionCounterId = Convert.ToInt32 (hfSectionCounter.Text); clsTabletDB.ITPValidHierarchy ITPHierarchy = new clsTabletDB.ITPValidHierarchy(); string[] sSolarStringNos = ITPHierarchy.GetValidHierarchy(7); //Create a list and convert the string array to the list. Why the system cannot take a simple string array is beyond me!!! List<string> listStringNo = new List<string> (); Array.ForEach (sSolarStringNos, value => listStringNo.Add (value.ToString ())); TableViewSource tabdata = new TableViewSource (listStringNo, true); tabdata.SetFont("Verdana",10f); UITableView cmbStringNo = new UITableView (); //If the bottom of the frame would be outside the main content frame make it go upwards instead of downwards UILabel hfContentHeight = (UILabel)View.ViewWithTag (3); int iContentHeight = Convert.ToInt32 (hfContentHeight.Text); if (iTop + 190f > (float)iContentHeight) { cmbStringNo.Frame = new RectangleF(iLeft, iTop - 190f, 90f, 200f); } else { cmbStringNo.Frame = new RectangleF(iLeft, iTop, 90f, 200f); } tabdata.SetParent(cmbStringNo); tabdata.SetUpdateFieldType("UITextField"); UITextField lblVwUpdate = (UITextField)View.ViewWithTag (iEquipmentStringTagId * (iPwrIdRow) + (iStringRow)); tabdata.SetTextFieldToUpdate(lblVwUpdate); UIView vwUnsaved = (UIView)View.ViewWithTag (60); tabdata.SetUnsavedChangesView(vwUnsaved); tabdata.SetShowUnsavedOnChange(true); //Also set the section flag to 1 that it has changed and the overall flag that it has changed UILabel lblUnsavedFlag = (UILabel)View.ViewWithTag (80); tabdata.SetUnsavedChangesHiddenLabel(lblUnsavedFlag); UILabel lblUnsavedSectionFlag = (UILabel)View.ViewWithTag ((iSectionCounterId + 1) * iSectionStatusTagId); tabdata.SetUnsavedChangesSectionHiddenLabel(lblUnsavedSectionFlag); cmbStringNo.Source = tabdata; iUtils.SESTable thistable = new iUtils.SESTable(); string sSelectedValue = lblVwUpdate.Text; thistable.SetTableSelectedText(cmbStringNo, sSelectedValue, sSolarStringNos, true); //Get the main scroll view UIScrollView scrollVw = (UIScrollView)View.ViewWithTag (2); scrollVw.AddSubview(cmbStringNo); }