private void RemoveBgImage() { try { TreeNode tn = tvItems.SelectedNode; if (tn != null) { BgImage bgImage = tn.Tag as BgImage; if (MessageBoxUtils.AskLocalized("_removeitems")) { tvItems.Nodes.Remove(tn); BgImages.Remove(bgImage); if (app.GetControlsAttr(ControlsAttr.AutoSave)) { using (Context context = Lib.GetContext()) bgImage.Remove(context); } if (OnBgImageRemoved != null) { OnBgImageRemoved(this, new BgImageEventArgs(bgImage)); } } } } catch (Exception ex) { Log.Exception(ex); } }
void AddBgImage() { try { GLib lib = Lib; Map map = app.CurrentMap; if (lib != null && map != null) { if (this.dlgOpenFile.ShowDialog() == DialogResult.OK) { BgImage bgImage = new BgImage(map); bgImage.FilePath = dlgOpenFile.FileName; BgImages.Add(bgImage); UpdateList(); if (app.GetControlsAttr(ControlsAttr.AutoSave)) { using (Context context = lib.GetContext()) bgImage.Save(context); } if (OnBgImageAdded != null) { OnBgImageAdded(this, new BgImageEventArgs(bgImage)); } } } } catch (Exception ex) { Log.Exception(ex); } }
public void Init(Sprite sps, bool isCanClick) { BgImage.sprite = sps; LoadTipImage.gameObject.SetActive(false); BgImage.GetComponent <Button>().interactable = isCanClick; transform.localScale = Vector3.one; }
public ActionResult Update(BgImage bgImage) { if (ModelState.IsValid) { BgImage BgImage = db.BgImages.Find(bgImage.Id); if (bgImage.ImageFile != null) { string imageName = DateTime.Now.ToString("ddMMyyyyHHmmssfff") + bgImage.ImageFile.FileName; string imagePath = Path.Combine(Server.MapPath("~/Uploads/img"), imageName); string OldImagePath = Path.Combine(Server.MapPath("~/Uploads/img"), BgImage.Image); System.IO.File.Delete(OldImagePath); bgImage.ImageFile.SaveAs(imagePath); BgImage.Image = imageName; } BgImage.CreatedDate = bgImage.CreatedDate; db.Entry(BgImage).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bgImage)); }
public ActionResult Delete(int id) { BgImage bgimage = db.BgImages.Find(id); if (bgimage == null) { return(HttpNotFound()); } db.BgImages.Remove(bgimage); db.SaveChanges(); return(RedirectToAction("Index")); }
private void Update() { if (SceneManager.GetActiveScene().name == "wikiSLAM") { if (isRecgnized && isLoadComplete) { BgImage.GetComponent <Button>().interactable = true; } } else { if (isLoadComplete) { BgImage.GetComponent <Button>().interactable = true; } } }
public ActionResult Update(int id) { if (Session["AdminId"] == null) { return(RedirectToAction("Index", "Login")); } BgImage bgImage = db.BgImages.Find(id); if (bgImage == null) { return(HttpNotFound()); } return(View(bgImage)); }
public ActionResult Create(BgImage bgImage) { if (ModelState.IsValid) { string imageName = DateTime.Now.ToString("ddMMyyyyHHmmssffff") + bgImage.ImageFile.FileName; string imagePath = Path.Combine(Server.MapPath("~/Uploads/img"), imageName); bgImage.ImageFile.SaveAs(imagePath); bgImage.Image = imageName; db.BgImages.Add(bgImage); db.SaveChanges(); return(RedirectToAction("Index")); } return(View()); }
private void tvItems_AfterCheck(object sender, System.Windows.Forms.TreeViewEventArgs e) { try { if (!updating) { BgImage bgImage = e.Node.Tag as BgImage; bgImage.isChecked = e.Node.Checked; if (OnBgImageChecked != null) { OnBgImageChecked(this, new BgImageEventArgs(bgImage)); } } } catch (Exception ex) { Log.Exception(ex); } }
public void Metamorphose(LegoUIMeta uiMeta) { if (MetamorphoseStage == LegoMetamorphoseStage.Completed) { MetamorphoseStage = LegoMetamorphoseStage.Metamorphosing; } if (rockerMeta == null) { rockerMeta = uiMeta.NextRocker; RectMeta = uiMeta.CurrentRect; } switch (metamorphose) { case MetamorphoseStatus.Rocker: YuLegoUtility.MetamorphoseRect(RectTransform, RectMeta); metamorphose = MetamorphoseStatus.BackgroundImage; break; case MetamorphoseStatus.BackgroundImage: BgImage.Metamorphose(rockerMeta.BgImageMeta); metamorphose = MetamorphoseStatus.RockerImage; break; case MetamorphoseStatus.RockerImage: RockerImage.Metamorphose(rockerMeta.RockerImageMeta); metamorphose = MetamorphoseStatus.Rocker; MetamorphoseStage = LegoMetamorphoseStage.Completed; break; default: throw new ArgumentOutOfRangeException(); } }
public override void Metamorphose(LegoUIMeta uiMeta) { if (MetamorphoseStage == LegoMetamorphoseStage.Completed) { MetamorphoseStage = LegoMetamorphoseStage.Metamorphosing; } if (ButtonMeta == null) { ButtonMeta = uiMeta.NextButton; RectMeta = uiMeta.CurrentRect; } switch (metamorphoseStatus) { // 按钮自身变形 case MetamorphoseStatus.Button: MetamorphoseRect(RectMeta); if (ButtonMeta.TransitionType == LegoTransition.ColorTint && ButtonMeta.ColorTintMeta != null) { var colorTintMeta = ButtonMeta.ColorTintMeta; colors = new ColorBlock { normalColor = colorTintMeta.NormalLegoColor.ToColor(), highlightedColor = colorTintMeta.HighlightedLegoColor.ToColor(), pressedColor = colorTintMeta.PressedLegoColor.ToColor(), disabledColor = colorTintMeta.DisabledLegoColor.ToColor(), colorMultiplier = colorTintMeta.ColorMultiplier, fadeDuration = colorTintMeta.FadeDuration }; } SoundEffectId = ButtonMeta.ButtonSoundId; metamorphoseStatus = MetamorphoseStatus.ButtonImage; break; case MetamorphoseStatus.ButtonImage: // 按钮附带的Image变形 BgImage.As <YuLegoImage>().Metamorphose(ButtonMeta.ButtonImageMeta); if (ButtonMeta.IsNonRectangularButtonImage) { IsNonRectangularButtonImage = true; BgImage.As <YuLegoImage>().alphaHitTestMinimumThreshold = ButtonMeta.ImageAlphaHitTestMinimumThreshold; } metamorphoseStatus = MetamorphoseStatus.SonText; break; case MetamorphoseStatus.SonText: if (ButtonMeta.IsTextActive) { SonText.gameObject.SetActive(true); SonText.Metamorphose(ButtonMeta.TextRect, ButtonMeta.TextMeta); } else { SonText.gameObject.SetActive(false); } metamorphoseStatus = MetamorphoseStatus.Button; MetamorphoseStage = LegoMetamorphoseStage.Completed; break; } }
private void AddNode(BgImage bgImage) { TreeNode tn = tvItems.Nodes.Add(bgImage.Name); tn.Tag = bgImage; }
public BgImageEventArgs(BgImage bgImage) { this.bgImage = bgImage; }
public BgImageProps(BgImage bgImage) : base(bgImage) { this.bgImage = bgImage; }
/// <summary> /// Converts the graph object to a string of data. /// </summary> /// <returns>Returns a string of data representing the graph object.</returns> public override string ToString() { StringBuilder sb = new StringBuilder(""); if (this.Title != null) { sb.Append(this.Title.ToString()); } if (this.LegendX != null) { sb.Append(this.LegendX.ToString()); } if (this.LabelStyleX != null) { sb.Append(this.LabelStyleX.ToString()); } if (this.TickSizeX > 0) { sb.Append(string.Format("&x_ticks={0}&\r\n", this.TickSizeX)); } if (this.AxisStepsX > 0) { sb.Append(string.Format("&x_axis_steps={0}&\r\n", this.AxisStepsX)); } if (this.LegendY != null) { sb.Append(this.LegendY.ToString()); } if (this.LegendYRight != null) { sb.Append(this.LegendYRight.ToString()); } if (this.LabelStyleY != null) { sb.Append(this.LabelStyleY.ToString()); } sb.Append(string.Format("&y_ticks=5,10,{0}&\r\n", this.StepsY)); // Lines/Data/Labels was here moving to object model. string suffix = ""; for (int i = 0; i < this.Data.Count; i++) { if (i > 0) { suffix = string.Format("_{0}", i + 1); } Type chart = this.Data[i].GetType(); if (chart == typeof(Charts.Bar)) { sb.Append(string.Format("&bar{0}={1}", suffix, this.Data[i].ToString())); } else if (chart == typeof(Charts.BarFilled)) { sb.Append(string.Format("&filled_bar{0}={1}", suffix, this.Data[i].ToString())); } else if (chart == typeof(Charts.AreaHollow)) { sb.Append(string.Format("&area_hollow{0}={1}", suffix, this.Data[i].ToString())); } else if (chart == typeof(Charts.LineHollow)) { sb.Append(string.Format("&line_hollow{0}={1}", suffix, this.Data[i].ToString())); } else if (chart == typeof(Charts.LineDot)) { sb.Append(string.Format("&line_dot{0}={1}", suffix, this.Data[i].ToString())); } else if (chart == typeof(Charts.Line)) { sb.Append(string.Format("&line{0}={1}", suffix, this.Data[i].ToString())); } else if (chart == typeof(Charts.Bar3D)) { sb.Append(string.Format("&bar_3d{0}={1}", suffix, this.Data[i].ToString())); } else if (chart == typeof(Charts.BarFade)) { sb.Append(string.Format("&bar_fade{0}={1}", suffix, this.Data[i].ToString())); } else if (chart == typeof(Charts.BarGlass)) { sb.Append(string.Format("&bar_glass{0}={1}", suffix, this.Data[i].ToString())); } sb.Append(string.Format("&values{0}=", suffix)); for (int j = 0; j < this.Data[i].Data.Count; j++) { if (j == 0) { sb.Append(this.Data[i].Data[j]); } else { sb.Append(string.Format(",{0}", this.Data[i].Data[j])); } } sb.Append("&\r\n"); } sb.Append(string.Format("&y_min={0}&\r\n", this.MinY)); sb.Append(string.Format("&y_max={0}&\r\n", this.MaxY)); if (this.MaxY2 != 0) { sb.Append(string.Format("&y2_max={0}&\r\n", this.MaxY2)); } if (this.MinY2 != 0) { sb.Append(string.Format("&y2_min={0}&\r\n", this.MinY2)); } if (this.BgColor.Length > 0) { sb.Append(string.Format("&bg_colour={0}&\r\n", this.BgColor)); } if (this.BgImage != null) { sb.Append(BgImage.ToString()); } if (this.AxisColorX.Length > 0) { sb.Append(string.Format("&x_axis_colour={0}&\r\n", this.AxisColorX)); sb.Append(string.Format("&x_grid_colour={0}&\r\n", this.GridColorX)); } if (this.AxisColorY.Length > 0) { sb.Append(string.Format("&y_axis_colour={0}&\r\n", this.AxisColorY)); } if (this.GridColorY.Length > 0) { sb.Append(string.Format("&y_grid_colour={0}&\r\n", this.GridColorY)); } if (this.AxisColorYRight.Length > 0) { sb.Append(string.Format("&y2_axis_colour={0}&\r\n", this.AxisColorYRight)); } if (this.AxisX3D != 0) { sb.Append(string.Format("&x_axis_3d={0}&\r\n", this.AxisX3D)); } if (this.InnerBg != null) { sb.Append(this.InnerBg.ToString()); } if (this.Pie != null) { sb.Append(this.Pie.ToString()); } if (this.ToolTip.Length > 0) { sb.Append(string.Format("&tool_tip={0}&\r\n", this.ToolTip)); } return(sb.ToString()); }
public override void Metamorphose(LegoUIMeta uiMeta) { if (MetamorphoseStage == LegoMetamorphoseStage.Completed) { MetamorphoseStage = LegoMetamorphoseStage.Metamorphosing; } if (tButtonMeta == null) { tButtonMeta = uiMeta.NextTButton; RectMeta = uiMeta.CurrentRect; } switch (tButtonStatus) { // 按钮自身变形 case YuTButtonMetamorphoseStatus.Button: MetamorphoseRect(RectMeta); if (tButtonMeta.TransitionType == LegoTransition.ColorTint && tButtonMeta.ColorTintMeta != null) { var colorTintMeta = tButtonMeta.ColorTintMeta; colors = new ColorBlock { normalColor = colorTintMeta.NormalLegoColor.ToColor(), highlightedColor = colorTintMeta.HighlightedLegoColor.ToColor(), pressedColor = colorTintMeta.PressedLegoColor.ToColor(), disabledColor = colorTintMeta.DisabledLegoColor.ToColor(), colorMultiplier = colorTintMeta.ColorMultiplier, fadeDuration = colorTintMeta.FadeDuration }; } tButtonStatus = YuTButtonMetamorphoseStatus.ButtonImage; break; case YuTButtonMetamorphoseStatus.ButtonImage: // 按钮附带的Image变形 BgImage.As <YuLegoImage>().Metamorphose(tButtonMeta.ButtonImageMeta); tButtonStatus = YuTButtonMetamorphoseStatus.IconImage; break; case YuTButtonMetamorphoseStatus.IconImage: IconImage.As <YuLegoImage>().Metamorphose(tButtonMeta.IconRectMeta, tButtonMeta.IconImageMeta); tButtonStatus = YuTButtonMetamorphoseStatus.SonText; break; case YuTButtonMetamorphoseStatus.SonText: if (tButtonMeta.IsTextActive) { SonText.gameObject.SetActive(true); SonText.Metamorphose(tButtonMeta.TextRect, tButtonMeta.TextMeta); } else { SonText.gameObject.SetActive(false); } tButtonMeta = null; tButtonStatus = YuTButtonMetamorphoseStatus.Button; MetamorphoseStage = LegoMetamorphoseStage.Completed; break; default: throw new ArgumentOutOfRangeException(); } }