void linkImg_Tapped(object sender, TappedRoutedEventArgs e) { bo.Play(); if (firstBlock == null) { firstImg = sender as LinkImage; firstBlock = (sender as LinkImage).DataContext as LinkBlock; firstImg.StartFlash(); } else { LinkBlock secondBlock = (sender as LinkImage).DataContext as LinkBlock; (sender as LinkImage).StopFlash(); firstImg.StopFlash(); if (linkmap.isCanDead(firstBlock, secondBlock)) { firstBlock.IsAlive = false; secondBlock.IsAlive = false; firstBlock = null; } else { firstBlock = null; } } }
private void LoadMapGrid() { //gameGrid.ClearValue(Grid.RowProperty); //gameGrid.ClearValue(Grid.ColumnProperty); for (int i = 0; i < LinkMap.MapY; i++) { RowDefinition rowDef = new RowDefinition(); gameGrid.RowDefinitions.Add(rowDef); } for (int i = 0; i < LinkMap.MapX; i++) { ColumnDefinition colDef = new ColumnDefinition(); gameGrid.ColumnDefinitions.Add(colDef); } for (int i = 0; i < LinkMap.MapY; i++) { for (int j = 0; j < LinkMap.MapX; j++) { LinkImage linkImg = new LinkImage(); linkImg.DataContext = linkmap[j, i]; linkImg.Tag = j.ToString() + i.ToString(); listTag.Add(linkImg.Tag); listImgs.Add(linkImg); linkImg.Tapped += linkImg_Tapped; gameGrid.Children.Add(linkImg); Grid.SetColumn(linkImg, j); Grid.SetRow(linkImg, i); } } linkmap.Restart(); }
protected void EgvContentSignIn_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView dataItem = (DataRowView)e.Row.DataItem; int key = BasePage.RequestInt32("NodeID"); string nodeName = ""; LinkImage image = e.Row.FindControl("LinkImageModel") as LinkImage; string itemIcon = ModelManager.GetCacheModelById(DataConverter.CLng(dataItem["ModelId"].ToString())).ItemIcon; if (string.IsNullOrEmpty(itemIcon)) { itemIcon = "Default.gif"; } image.Icon = itemIcon; if (dataItem["LinkType"].ToString() != "0") { image.IsShowLink = true; } if (DataConverter.CLng(dataItem["NodeID"].ToString()) != key) { key = DataConverter.CLng(dataItem["NodeID"].ToString()); if (this.m_NodeNameDictionary.ContainsKey(key)) { nodeName = this.m_NodeNameDictionary[key]; } else { NodeInfo cacheNodeById = EasyOne.Contents.Nodes.GetCacheNodeById(key); if (!cacheNodeById.IsNull) { nodeName = cacheNodeById.NodeName; this.m_NodeNameDictionary.Add(key, nodeName); } } ExtendedHyperLink link = e.Row.FindControl("LnkNodeLink") as ExtendedHyperLink; link.BeginTag = "<strong>["; link.Text = nodeName; link.EndTag = "]</strong>"; link.NavigateUrl = "Signin.aspx?NodeID=" + dataItem["NodeID"].ToString(); } HyperLink link2 = e.Row.FindControl("HypTitle") as HyperLink; link2.NavigateUrl = string.Concat(new object[] { base.FullBasePath, "Item/", dataItem["GeneralId"], ".aspx" }); Label label = e.Row.FindControl("LblSignInStatus") as Label; LinkButton button = e.Row.FindControl("ELbtnContentSignIn") as LinkButton; if (DataConverter.CBoolean(dataItem["IsSignin"].ToString())) { label.Text = "<span style=\"color:Green\">已签收</span>"; button.Enabled = false; } else { label.Text = "<span style=\"color:Red\">未签收</span>"; button.Enabled = true; } } }
public ActionResult Create(Product product, HttpPostedFileBase Image, HttpPostedFileBase[] moreimage) { if (ModelState.IsValid) { string path = Server.MapPath("~/Uploads/AnhSanPham"); string pathMoreimage = Server.MapPath("~/Uploads/AnhChiTietSanPham"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string filename = Image.FileName.Split('\\').Last(); Image.SaveAs(path + "\\" + filename); product.pro_Image = "/Uploads/AnhSanPham" + "\\" + filename; product.pro_Status = true; product.pro_Date = DateTime.Now; product.sale = false; db.Products.Add(product); db.SaveChanges(); int id = product.pro_ID; if (moreimage.FirstOrDefault() != null) { foreach (var item in moreimage) { if (!Directory.Exists(pathMoreimage)) { Directory.CreateDirectory(pathMoreimage); } string Selectfile = item.FileName.Split('\\').Last(); item.SaveAs(pathMoreimage + "\\" + Selectfile); LinkImage smallimage = new LinkImage(); smallimage.pro_ID = id; smallimage.link_ImageSmall = "/Uploads/AnhChiTietSanPham" + "\\" + Selectfile; db.LinkImages.Add(smallimage); db.SaveChanges(); } } return(RedirectToAction("Create")); } ViewBag.Color_ID = new SelectList(db.Colors, "Color_ID", "NameColor", product.Color_ID); ViewBag.group_ID = new SelectList(db.GroupProducts, "group_ID", "group_Name", product.group_ID); ViewBag.Menu_ID = new SelectList(db.Menus.Where(x => x.ParentIid != null).ToList(), "Menu_ID", "Name", product.Menu_ID); ViewBag.OptionID = new SelectList(db.OptionSales, "OptionID", "Name", product.OptionID); ViewBag.OptionID = new SelectList(db.OptionSales, "OptionID", "Name", product.OptionID); return(View(product)); }
protected void EgvSpecialInfos_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int length = 0; SpecialCommonModelInfo dataItem = (SpecialCommonModelInfo)e.Row.DataItem; Label label = e.Row.FindControl("LblIsCreateHtml") as Label; if (!dataItem.CreateTime.HasValue || (dataItem.CreateTime.Value <= dataItem.UpdateTime)) { label.Text = "<span style=\"color:Red\"><b>\x00d7</b></span>"; } else { label.Text = "<b>√</b>"; } LinkImage image = e.Row.FindControl("LinkImageModel") as LinkImage; string itemIcon = ModelManager.GetCacheModelById(dataItem.ModelId).ItemIcon; if (string.IsNullOrEmpty(itemIcon)) { itemIcon = "Default.gif"; } image.Icon = itemIcon; if (dataItem.LinkType != 0) { image.IsShowLink = true; } HyperLink link = e.Row.FindControl("HypTitle") as HyperLink; length = 0x25 - length; link.Text = StringHelper.SubString(dataItem.Title, length, "..."); link.ToolTip = dataItem.Title; link.NavigateUrl = "ContentView.aspx?GeneralID=" + dataItem.GeneralId.ToString(); if (!this.m_Administrator) { LinkButton button = (LinkButton)e.Row.FindControl("DeleteSpecialInfoById"); if (BasePage.RequestInt32("SpecialID") > 0) { button.Enabled = this.m_IsManage; } else if (!RolePermissions.AccessCheckSpecialPermission(OperateCode.SepcialContentManage, dataItem.SpecialId)) { button.Enabled = false; } } } }
private void btnHelpMe_Click(object sender, RoutedEventArgs e) { LinkBlock[] linkHelps = linkmap.HelpMe(); if (linkHelps[0] != null) { LinkBlock b1 = linkHelps[0]; LinkBlock b2 = linkHelps[1]; LinkImage i1 = listImgs.First(linkImage => linkImage.Tag == b1.Tag); LinkImage i2 = listImgs.First(linkImage => linkImage.Tag == b2.Tag); i1.StartFlash(); i2.StartFlash(); b1 = null; b2 = null; linkHelps = null; } else { MessageDialog msd = new MessageDialog("没有可连了你完蛋了!"); msd.ShowAsync(); } }
private async void Button_Click_2(object sender, RoutedEventArgs e) { LinkBlock[] linkHelps = linkmap.HelpMe(); if (linkHelps[0] != null) { LinkBlock b1 = linkHelps[0]; LinkBlock b2 = linkHelps[1]; LinkImage i1 = listImgs.First(linkImage => linkImage.Tag == b1.Tag); LinkImage i2 = listImgs.First(linkImage => linkImage.Tag == b2.Tag); i1.StartFlash(); i2.StartFlash(); b1 = null; b2 = null; linkHelps = null; } else { MessageDialog msd = new MessageDialog("没有可连了你完蛋了!"); await msd.ShowAsync(); } //int i, j; //i = linkHelps[0].X; //j = linkHelps[0].Y; //foreach(var itemLinkImg in listImgs.Where(LinkImage =>LinkImage.Tag==b1.Tag)) //{ // if (i1==null) // { // i1 = itemLinkImg as LinkImage; // } //} // foreach(var itemLinkImg in listImgs.Where(LinkBlock=>LinkBlock.Tag==b2.Tag)) // { // if(i2==null) // { // i2 = itemLinkImg as LinkImage; // } // } //i1=where(b1=>b1.Tag==i1.Tag) //where(x=>x.Tag==控件.Tag) }
public string GetBrokenProperty() { if (Link.IsEmpty()) { return("Link"); } if (Description.IsEmpty()) { return("Description"); } if (LinkImage.IsEmpty()) { return("LinkImage"); } if (Price.ValueMin == null) { return("Price.ValueMin"); } return(null); }
private void Button_Click(object sender, RoutedEventArgs e) { listImgs.Clear(); listTag.Clear(); for (int i = 0; i < LinkMap.MapY; i++) { for (int j = 0; j < LinkMap.MapX; j++) { LinkImage linkImg = new LinkImage(); linkImg.DataContext = linkmap[j, i]; linkImg.Tag = j.ToString() + i.ToString(); listTag.Add(linkImg.Tag); listImgs.Add(linkImg); linkImg.Tapped += linkImg_Tapped; gameGrid.Children.Add(linkImg); Grid.SetColumn(linkImg, j); Grid.SetRow(linkImg, i); } } linkmap.Restart(); btnNew.Content = "重新开始"; }
protected void EgvContent_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { CommonModelInfo dataItem = (CommonModelInfo)e.Row.DataItem; int length = 0; NodeInfo cacheNodeById = null; if (this.m_NodeInfoDictionary.ContainsKey(dataItem.NodeId)) { cacheNodeById = this.m_NodeInfoDictionary[dataItem.NodeId]; } else { cacheNodeById = Nodes.GetCacheNodeById(dataItem.NodeId); if (!cacheNodeById.IsNull) { this.m_NodeInfoDictionary.Add(dataItem.NodeId, cacheNodeById); } } if (dataItem.NodeId != this.m_NodeId) { ExtendedHyperLink link = e.Row.FindControl("LnkNodeLink") as ExtendedHyperLink; link.BeginTag = "<strong>["; link.Text = cacheNodeById.NodeName; link.EndTag = "]</strong>"; link.NavigateUrl = "ContentManage.aspx?NodeID=" + dataItem.NodeId.ToString() + "&NodeName=" + base.Server.UrlEncode(cacheNodeById.NodeName); length = StringHelper.SubStringLength(cacheNodeById.NodeName) + 2; } LinkImage image = e.Row.FindControl("LinkImageModel") as LinkImage; string itemIcon = ModelManager.GetCacheModelById(dataItem.ModelId).ItemIcon; if (string.IsNullOrEmpty(itemIcon)) { itemIcon = "Default.gif"; } image.Icon = itemIcon; if (dataItem.LinkType != 0) { image.IsShowLink = true; } HyperLink link2 = (HyperLink)e.Row.FindControl("ContentModify"); LinkButton button = (LinkButton)e.Row.FindControl("LtnDelete"); string str2 = dataItem.NodeId.ToString(); if (cacheNodeById.ParentId > 0) { str2 = str2 + "," + cacheNodeById.ParentPath; } if (!StringHelper.FoundCharInArr(this.m_arrNodeIdInput, dataItem.NodeId.ToString())) { link2.Enabled = false; button.Enabled = false; button.OnClientClick = ""; } else if (!this.m_IsManageStatusPassContent && (dataItem.Status == 0x63)) { CheckBox box = (CheckBox)e.Row.FindControl("CheckBoxButton"); link2.Enabled = false; button.Enabled = false; button.OnClientClick = ""; box.Enabled = false; } if (ModelManager.GetCacheModelById(dataItem.ModelId).Disabled) { link2.Enabled = false; button.Enabled = false; button.OnClientClick = ""; } if (dataItem.IsEshop) { link2.NavigateUrl = string.Concat(new object[] { "../Shop/Product.aspx?Action=Modify&NodeID=", dataItem.NodeId.ToString(), "&GeneralID=", dataItem.GeneralId, "&ModelID=", dataItem.ModelId.ToString() }); } else { link2.NavigateUrl = string.Concat(new object[] { "Content.aspx?Action=Modify&NodeID=", dataItem.NodeId.ToString(), "&GeneralID=", dataItem.GeneralId, "&ModelID=", dataItem.ModelId.ToString() }); } HyperLink link3 = e.Row.FindControl("LnkItem") as HyperLink; length = 0x25 - length; link3.Text = StringHelper.SubString(dataItem.Title, length, "..."); link3.ToolTip = dataItem.Title; link3.Target = "_blank"; link3.NavigateUrl = base.FullBasePath + "Item/" + dataItem.GeneralId.ToString() + ".aspx"; if (dataItem.Status != 0x63) { link3.Target = ""; link3.NavigateUrl = link2.NavigateUrl; } } }
private void SelectChecker(object sender, MouseButtonEventArgs e) { var checker = (LinkImage)sender; if (this.isSelected) { LinkItem cornerOne, cornerTwo; if (this.selectedChecker != checker && this.selectedChecker.Value.Value == checker.Value.Value && CanConnect(this.selectedChecker.Value, checker.Value, out cornerOne, out cornerTwo)) { var startY = (this.selectedChecker.Value.Row * 42) + 020; var startX = (this.selectedChecker.Value.Column * 42) + 020; var startPoint = new Point(startX, startY); var line = LinkLineHelper.CreatePolyline(startPoint); if (cornerOne != null) { var cornerOneY = (cornerOne.Row * 42) + 020; var cornerOneX = (cornerOne.Column * 42) + 020; var cornerOnePoint = new Point(cornerOneX, cornerOneY); line.Points.Add(cornerOnePoint); } if (cornerTwo != null) { var cornerTwoY = (cornerTwo.Row * 42) + 20; var cornerTwoX = (cornerTwo.Column * 42) + 20; var cornerTwoPoint = new Point(cornerTwoX, cornerTwoY); line.Points.Add(cornerTwoPoint); } var endY = (checker.Value.Row * 42) + 020; var endX = (checker.Value.Column * 42) + 020; var endPoint = new Point(endX, endY); line.Points.Add(endPoint); LinkLineHelper.DrawingPolyline(this.Container, line); this.isSelected = false; this.selectedChecker.IsEnabled = false; checker.IsEnabled = false; var timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 0, 200) }; timer.Tick += (_, __) => { LinkLineHelper.RemovePolyline(this.Container, line); this.selectedChecker.Value.IsDead = true; this.selectedChecker.IsDead = true; checker.Value.IsDead = true; checker.IsDead = true; timer.Stop(); }; timer.Start(); } else { this.isSelected = true; this.selectedChecker.IsSelected = false; checker.IsSelected = true; this.selectedChecker = checker; } } else { this.isSelected = true; this.selectedChecker = checker; checker.IsSelected = true; } }
public ActionResult Edit(Product product, HttpPostedFileBase Image, Boolean DeleteSmallImage, HttpPostedFileBase[] moreimage) { if (ModelState.IsValid) { string path = Server.MapPath("~/Uploads/AnhSanPham"); string pathMoreimage = Server.MapPath("~/Uploads/AnhChiTietSanPham"); if (Image != null) { if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string filename = Image.FileName.Split('\\').Last(); Image.SaveAs(path + "\\" + filename); product.pro_Image = "/Uploads/AnhSanPham" + "\\" + filename; } if (DeleteSmallImage.Equals(true)) { var remove = db.LinkImages.Where(x => x.pro_ID == product.pro_ID).ToList(); foreach (var i in remove) { db.LinkImages.Remove(i); } } if (moreimage.FirstOrDefault() != null) { var deteleitem = db.LinkImages.Where(x => x.pro_ID == product.pro_ID).ToList(); foreach (var item in deteleitem) { db.LinkImages.Remove(item); } foreach (var item in moreimage) { if (!Directory.Exists(pathMoreimage)) { Directory.CreateDirectory(pathMoreimage); } string Selectfile = item.FileName.Split('\\').Last(); item.SaveAs(pathMoreimage + "\\" + Selectfile); LinkImage smallimage = new LinkImage(); smallimage.pro_ID = product.pro_ID; smallimage.link_ImageSmall = "/Uploads/AnhChiTietSanPham" + "\\" + Selectfile; db.LinkImages.Add(smallimage); } } db.Entry(product).State = EntityState.Modified; if (product.pro_Quanty > 0) { product.pro_Status = true; } db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Color_ID = new SelectList(db.Colors, "Color_ID", "NameColor", product.Color_ID); ViewBag.group_ID = new SelectList(db.GroupProducts, "group_ID", "group_Name", product.group_ID); ViewBag.Menu_ID = new SelectList(db.Menus, "Menu_ID", "Name", product.Menu_ID); ViewBag.OptionID = new SelectList(db.OptionSales, "OptionID", "Name", product.OptionID); ViewBag.OptionID = new SelectList(db.OptionSales, "OptionID", "Name", product.OptionID); return(View(product)); }
public void Step4_ShowMatrix( AeroNavigationBar.HistoryInfo History, LinkImage[] Source, ComparisionInfo[] Comparision, ComparisionValue[] Values) { History.AddFrame( delegate { var More = Comparision.Count(k => k.WaitingForUser && k.Value == null); this.Title.Text = "The Matrix. You have " + More + " image pairs to compare..."; #region headers var o = Source.Select<LinkImage, Action>( (k, i) => { k.SizeTo(0.15); k.AttachContainerTo(this); k.MoveContainerTo(60, 150 + i * 60); var kx = new TextButtonControl { Text = "#" + (1 + i), Width = 40, Height = 32 }; kx.AttachContainerTo(this); kx.MoveContainerTo(130, 160 + i * 60); kx.Background.Fill = Brushes.White; kx.Background.Opacity = 0.3; var ky = new TextButtonControl { Text = "#" + (1 + i), Width = 40, Height = 32 }; ky.AttachContainerTo(this); ky.MoveContainerTo(200 + i * 60, 100); ky.Background.Fill = Brushes.White; ky.Background.Opacity = 0.3; var kxr = new Rectangle { Fill = Brushes.Black, Width = Source.Length * 60 + 140, Height = 1 }; kxr.AttachTo(this); kxr.MoveTo(60, 200 + i * 60); var kyr = new Rectangle { Fill = Brushes.Black, Height = Source.Length * 60 + 60, Width = 1 }; kyr.AttachTo(this); kyr.MoveTo(250 + i * 60, 100); return delegate { k.OrphanizeContainer(); kx.OrphanizeContainer(); ky.OrphanizeContainer(); kxr.Orphanize(); kyr.Orphanize(); }; } ).ToArray(); #endregion #region values var v = Comparision.Select<ComparisionInfo, Action>( k => { var kt = new TextButtonControl { Text = "", Width = 40, Height = 32 }; kt.AttachContainerTo(this); kt.MoveContainerTo(200 + k.X * 60, 160 + k.Y * 60); kt.Background.Fill = Brushes.White; kt.Background.Opacity = 0.3; if (k.Value == null) { if (k.WaitingForUser) { kt.Background.Fill = Brushes.Yellow; kt.Background.Opacity = 0.5; } } else { kt.Text = k.Value.ToString(); if (k.Value.Value == 1) { kt.Background.Fill = Brushes.Cyan; kt.Background.Opacity = 0.5; } } return delegate { kt.OrphanizeContainer(); }; } ).ToArray(); #endregion return delegate { this.Title.Text = "..."; o.ForEach(h => h()); v.ForEach(h => h()); }; } ); }
protected void EgvContent_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { CommonModelInfo dataItem = (CommonModelInfo)e.Row.DataItem; int nodeId = dataItem.NodeId; string s = ""; int length = 0; if (this.m_NodeInfoDictionary.ContainsKey(dataItem.NodeId)) { s = this.m_NodeInfoDictionary[dataItem.NodeId].NodeName; } else { NodeInfo cacheNodeById = Nodes.GetCacheNodeById(dataItem.NodeId); if (!cacheNodeById.IsNull) { s = cacheNodeById.NodeName; this.m_NodeInfoDictionary.Add(dataItem.NodeId, cacheNodeById); } } if (dataItem.NodeId != this.m_NodeId) { ExtendedHyperLink link = e.Row.FindControl("LnkNodeLink") as ExtendedHyperLink; link.BeginTag = "<strong>["; link.Text = s; link.EndTag = "]</strong>"; link.NavigateUrl = "ContentManage.aspx?NodeID=" + dataItem.NodeId.ToString() + "&NodeName=" + base.Server.UrlEncode(s); length = StringHelper.SubStringLength(s) + 2; } HyperLink link2 = e.Row.FindControl("HypTitle") as HyperLink; LinkImage image = e.Row.FindControl("LinkImageModel") as LinkImage; string itemIcon = ModelManager.GetCacheModelById(dataItem.ModelId).ItemIcon; if (string.IsNullOrEmpty(itemIcon)) { itemIcon = "Default.gif"; } image.Icon = itemIcon; if (dataItem.LinkType != 0) { image.IsShowLink = true; } if (this.m_ModelPreviewDictionary.ContainsKey(dataItem.ModelId)) { link2.NavigateUrl = this.m_ModelPreviewDictionary[dataItem.ModelId] + "?GeneralID=" + dataItem.GeneralId; } else { ModelInfo modelInfoById = ModelManager.GetModelInfoById(dataItem.ModelId); link2.NavigateUrl = modelInfoById.PreviewInfoFilePath + "?GeneralID=" + dataItem.GeneralId; this.m_ModelPreviewDictionary.Add(dataItem.ModelId, modelInfoById.PreviewInfoFilePath); } dataItem.Title = dataItem.Title; length = 0x25 - length; link2.Text = StringHelper.SubString(dataItem.Title, length, "..."); link2.ToolTip = "标 题:" + dataItem.Title + "\r\n录 入 者:" + dataItem.Inputer + "\r\n更新时间:" + dataItem.UpdateTime.ToString(); Label label = e.Row.FindControl("LblIsCreateHtml") as Label; if (!dataItem.CreateTime.HasValue || (dataItem.CreateTime.Value <= dataItem.UpdateTime)) { label.Text = "<span style=\"color:Red\"><b>\x00d7</b></span>"; } else { label.Text = "<b>√</b>"; } LinkButton button = (LinkButton)e.Row.FindControl("CancelArchiving"); LinkButton button2 = (LinkButton)e.Row.FindControl("ContentDelete"); button.Text = "取消归档"; button.CommandName = "CancelArchiving"; button.CommandArgument = dataItem.GeneralId.ToString(); button.OnClientClick = "if(!this.disabled) return confirm('确实要还原此归档信息吗?');"; button2.Text = "删除"; button2.CommandName = "DeleteContent"; button2.CommandArgument = dataItem.GeneralId.ToString(); button2.OnClientClick = "if(!this.disabled) return confirm('确实要删除此信息吗?删除后你还可以从回收站中还原!');"; if (ModelManager.GetCacheModelById(dataItem.ModelId).Disabled) { button2.Enabled = false; button.Enabled = false; } } }
public void Step5_ShowMistakeMatrix( AeroNavigationBar.HistoryInfo History, LinkImage[] Source, ComparisionInfo[] Comparision, ComparisionValue[] Values) { History.AddFrame( delegate { var More = Comparision.Count(k => k.WaitingForUser && k.Value == null); #region headers var o = Source.Select<LinkImage, Action>( (k, i) => { k.SizeTo(0.15); k.AttachContainerTo(this); k.MoveContainerTo(60, 150 + i * 60); var kx = new TextButtonControl { Text = "#" + (1 + i), Width = 40, Height = 32 }; kx.AttachContainerTo(this); kx.MoveContainerTo(130, 160 + i * 60); kx.Background.Fill = Brushes.White; kx.Background.Opacity = 0.3; var ky = new TextButtonControl { Text = "#" + (1 + i), Width = 40, Height = 32 }; ky.AttachContainerTo(this); ky.MoveContainerTo(200 + i * 60, 100); ky.Background.Fill = Brushes.White; ky.Background.Opacity = 0.3; var kxr = new Rectangle { Fill = Brushes.Black, Width = Source.Length * 60 + 140, Height = 1 }; kxr.AttachTo(this); kxr.MoveTo(60, 200 + i * 60); var kyr = new Rectangle { Fill = Brushes.Black, Height = Source.Length * 60 + 60, Width = 1 }; kyr.AttachTo(this); kyr.MoveTo(250 + i * 60, 100); return delegate { k.OrphanizeContainer(); kx.OrphanizeContainer(); ky.OrphanizeContainer(); kxr.Orphanize(); kyr.Orphanize(); }; } ).ToArray(); #endregion #region values var Mistakes = Comparision.Where(q => q.WaitingForUser).ToArray( q => { var x_cells = Comparision.Where(k => k.X == q.Y).OrderBy(k => k.Y).ToArray(); var x_product = x_cells.Product(k => k.GetCurrentValue()); var y_cells = Comparision.Where(k => k.Y == q.X).OrderBy(k => k.X).ToArray(); var y_product = y_cells.Product(k => k.GetCurrentValue()); var z = Math.Pow(q.GetCurrentValue(), Source.Length); return new { q, Mistake = 1.0 / Math.Pow(x_product * y_product * z, 1.0 / (Source.Length - 2)) }; /* 1/POWER(PRODUCT(R4C2:R9C2)*PRODUCT(R9C2:R9C7)*POWER(R[-46]C;veerge);1/(veerge-2)) 1/POWER(x_product*y_product*POWER(R[-46]C;veerge);1/(veerge-2)) 1/POWER(x_product*y_product*z;1/(veerge-2)) */ } ).OrderBy( ContextMistakes => { var Mistakes_Max = ContextMistakes.Max(k => k.Mistake); var Mistakes_Min = ContextMistakes.Min(k => k.Mistake); var Mistake_Value = Mistakes_Min; if (Mistakes_Max * Mistakes_Min > 1.0) Mistake_Value = Mistakes_Max; return ContextMistakes.First(k => k.Mistake == Mistake_Value); } ).ToArray(); var Gradient = Colors.Red.ToGradient(Colors.Blue, Mistakes.Length).ToArray(); Title.Text = "Biggest mistake was made at " + Mistakes.First().q.ToVersusString() + ". Click on a cell to recompare."; var v = Mistakes.Select( (k, k_index) => { var kt = new TextButtonControl { Text = "", Width = 60 - 4, Height = 32 }; kt.AttachContainerTo(this); kt.MoveContainerTo(192 + k.q.X * 60, 160 + k.q.Y * 60); kt.Background.Fill = new SolidColorBrush(Gradient[k_index]); kt.Text = k.Mistake.ToString(); kt.Click += delegate { var NewComparision = Comparision.ToArray( oo => { var n = new ComparisionInfo { WaitingForUser = oo.WaitingForUser, Value = oo.Value, X = oo.X, Y = oo.Y }; if (oo == k.q) { n.Value = null; } return n; } ); Step3_Compare(History, Source, NewComparision, Values); }; return new Action( delegate { kt.OrphanizeContainer(); } ); } ).ToArray(); #endregion return delegate { this.Title.Text = "..."; o.ForEach(h => h()); v.ForEach(h => h()); }; } ); }
protected void EgvContents_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { CommonModelInfo commonModelInfo = new CommonModelInfo(); commonModelInfo = (CommonModelInfo)e.Row.DataItem; int nodeId = BasePage.RequestInt32("NodeID"); string s = ""; int length = 0; NodeInfo cacheNodeById = new NodeInfo(true); if (commonModelInfo.NodeId != nodeId) { nodeId = commonModelInfo.NodeId; if (this.m_NodeNameDictionary.ContainsKey(commonModelInfo.NodeId)) { cacheNodeById = this.m_NodeNameDictionary[commonModelInfo.NodeId]; s = cacheNodeById.NodeName; } else { cacheNodeById = Nodes.GetCacheNodeById(commonModelInfo.NodeId); if (cacheNodeById != null) { s = cacheNodeById.NodeName; this.m_NodeNameDictionary.Add(commonModelInfo.NodeId, cacheNodeById); } } ExtendedHyperLink link = e.Row.FindControl("LnkNodeLink") as ExtendedHyperLink; link.BeginTag = "<strong>["; link.Text = s; link.EndTag = "]</strong>"; link.NavigateUrl = "ContentHtml.aspx?NodeID=" + commonModelInfo.NodeId.ToString() + "&NodeName=" + base.Server.UrlEncode(s); length = StringHelper.SubStringLength(s) + 2; } LinkImage image = e.Row.FindControl("LinkImageModel") as LinkImage; string itemIcon = ModelManager.GetCacheModelById(commonModelInfo.ModelId).ItemIcon; if (string.IsNullOrEmpty(itemIcon)) { itemIcon = "Default.gif"; } image.Icon = itemIcon; if (commonModelInfo.LinkType != 0) { image.IsShowLink = true; } HyperLink link2 = e.Row.FindControl("HypTitle") as HyperLink; if (this.m_ModelPreviewDictionary.ContainsKey(commonModelInfo.ModelId)) { link2.NavigateUrl = this.m_ModelPreviewDictionary[commonModelInfo.ModelId] + "?GeneralID=" + commonModelInfo.GeneralId; } else { ModelInfo modelInfoById = ModelManager.GetModelInfoById(commonModelInfo.ModelId); link2.NavigateUrl = modelInfoById.PreviewInfoFilePath + "?GeneralID=" + commonModelInfo.GeneralId; this.m_ModelPreviewDictionary.Add(commonModelInfo.ModelId, modelInfoById.PreviewInfoFilePath); } commonModelInfo.Title = commonModelInfo.Title; length = 0x25 - length; link2.Text = StringHelper.SubString(commonModelInfo.Title, length, "..."); link2.ToolTip = commonModelInfo.Title; Label label = e.Row.FindControl("LblIsCreateHtml") as Label; if (!commonModelInfo.CreateTime.HasValue || (commonModelInfo.CreateTime.Value <= commonModelInfo.UpdateTime)) { label.Text = "<span style=\"color:Red\"><b>\x00d7</b></span>"; ((HyperLink)e.Row.FindControl("LnkHtmlView")).Enabled = false; ((LinkButton)e.Row.FindControl("LnkDeleteHtml")).Enabled = false; } else { if (this.m_NodeNameDictionary.ContainsKey(commonModelInfo.NodeId)) { cacheNodeById = this.m_NodeNameDictionary[commonModelInfo.NodeId]; } else { cacheNodeById = Nodes.GetCacheNodeById(commonModelInfo.NodeId); if (!cacheNodeById.IsNull) { s = cacheNodeById.NodeName; this.m_NodeNameDictionary.Add(commonModelInfo.NodeId, cacheNodeById); } } label.Text = "<b>√</b>"; string str3 = (SiteConfig.SiteInfo.VirtualPath + VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + ContentManage.ContentHtmlName(commonModelInfo, cacheNodeById, 0)).Replace("//", "/"); ((HyperLink)e.Row.FindControl("LnkHtmlView")).NavigateUrl = str3; } if (!this.m_Administrator) { string checkStr = nodeId.ToString(); if (cacheNodeById.IsNull) { cacheNodeById = Nodes.GetCacheNodeById(nodeId); } if (cacheNodeById.ParentId > 0) { checkStr = checkStr + "," + cacheNodeById.ParentPath; } if (!StringHelper.FoundCharInArr(checkStr, this.m_arrContentNodeIdManage)) { ((LinkButton)e.Row.FindControl("LnkCreateHtml")).Enabled = false; ((HyperLink)e.Row.FindControl("LnkHtmlView")).Enabled = false; ((LinkButton)e.Row.FindControl("LnkDeleteHtml")).Enabled = false; } } } }
protected void EgvContentRecycle_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { CommonModelInfo dataItem = new CommonModelInfo(); dataItem = (CommonModelInfo)e.Row.DataItem; NodeInfo cacheNodeById = new NodeInfo(true); int length = 0; string nodeName = ""; if (dataItem.NodeId != this.nodeId) { this.nodeId = dataItem.NodeId; if (this.m_NodeNameDictionary.ContainsKey(dataItem.NodeId)) { nodeName = this.m_NodeNameDictionary[dataItem.NodeId]; } else { cacheNodeById = Nodes.GetCacheNodeById(dataItem.NodeId); if (cacheNodeById != null) { nodeName = cacheNodeById.NodeName; this.m_NodeNameDictionary.Add(dataItem.NodeId, nodeName); } } ExtendedHyperLink link = e.Row.FindControl("LnkNodeLink") as ExtendedHyperLink; link.BeginTag = "<strong>["; link.Text = nodeName; link.EndTag = "]</strong>"; link.NavigateUrl = "ContentManage.aspx?NodeID=" + dataItem.NodeId.ToString() + "&NodeName=" + base.Server.UrlEncode(nodeName); length = StringHelper.SubStringLength(nodeName) + 2; } HyperLink link2 = e.Row.FindControl("HypTitle") as HyperLink; length = 0x25 - length; link2.Text = StringHelper.SubString(dataItem.Title, length, "..."); link2.ToolTip = dataItem.Title; link2.NavigateUrl = "ContentView.aspx?GeneralID=" + dataItem.GeneralId.ToString(); Label label = e.Row.FindControl("LblIsCreateHtml") as Label; label.Text = "<span style=\"color:Red\"><b>\x00d7</b></span>"; LinkImage image = e.Row.FindControl("LinkImageModel") as LinkImage; string itemIcon = ModelManager.GetCacheModelById(dataItem.ModelId).ItemIcon; if (string.IsNullOrEmpty(itemIcon)) { itemIcon = "Default.gif"; } image.Icon = itemIcon; if (dataItem.LinkType != 0) { image.IsShowLink = true; } if (!this.m_Administrator) { string checkStr = this.nodeId.ToString(); if (cacheNodeById.IsNull) { cacheNodeById = Nodes.GetCacheNodeById(this.nodeId); } if (cacheNodeById.ParentId > 0) { checkStr = checkStr + "," + cacheNodeById.ParentPath; } if (!StringHelper.FoundCharInArr(checkStr, this.m_arrContentNodeIdManage)) { ((LinkButton)e.Row.FindControl("DeleteContent")).Enabled = false; ((LinkButton)e.Row.FindControl("RestoreContent")).Enabled = false; } } } }
protected void EgvContentSignin_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { CommonModelInfo dataItem = (CommonModelInfo)e.Row.DataItem; NodeInfo cacheNodeById = new NodeInfo(true); int length = 0; int nodeId = BasePage.RequestInt32("NodeID"); string nodeName = ""; if (dataItem.NodeId != nodeId) { nodeId = dataItem.NodeId; if (this.m_NodeNameDictionary.ContainsKey(dataItem.NodeId)) { nodeName = this.m_NodeNameDictionary[dataItem.NodeId]; } else { cacheNodeById = Nodes.GetCacheNodeById(dataItem.NodeId); if (!cacheNodeById.IsNull) { nodeName = cacheNodeById.NodeName; this.m_NodeNameDictionary.Add(dataItem.NodeId, nodeName); } } ExtendedHyperLink link = e.Row.FindControl("LnkNodeLink") as ExtendedHyperLink; link.BeginTag = "<strong>["; link.Text = nodeName; link.EndTag = "]</strong>"; link.NavigateUrl = "ContentHtml.aspx?NodeID=" + dataItem.NodeId.ToString() + "&NodeName=" + base.Server.UrlEncode(nodeName); length = StringHelper.SubStringLength(nodeName) + 2; } Label label = e.Row.FindControl("LblIsCreateHtml") as Label; if (!dataItem.CreateTime.HasValue || (dataItem.CreateTime.Value <= dataItem.UpdateTime)) { label.Text = "<span style=\"color:Red\"><b>\x00d7</b></span>"; } else { label.Text = "<b>√</b>"; } LinkImage image = e.Row.FindControl("LinkImageModel") as LinkImage; string itemIcon = ModelManager.GetCacheModelById(dataItem.ModelId).ItemIcon; if (string.IsNullOrEmpty(itemIcon)) { itemIcon = "Default.gif"; } image.Icon = itemIcon; if (dataItem.LinkType != 0) { image.IsShowLink = true; } Label label2 = e.Row.FindControl("lblSigninStatus") as Label; SignInContentInfo signInContentByGeneralId = SignInContent.GetSignInContentByGeneralId(dataItem.GeneralId); string signInUsers = SignInLog.GetSignInUsers(dataItem.GeneralId); IList <SignInLogInfo> list = SignInLog.GetList(dataItem.GeneralId); StringBuilder sb = new StringBuilder(); StringBuilder builder2 = new StringBuilder(); foreach (SignInLogInfo info4 in list) { if (info4.IsSignIn) { StringHelper.AppendString(sb, info4.UserName); } else { StringHelper.AppendString(builder2, info4.UserName); } } string str4 = ""; if (!signInContentByGeneralId.IsNull) { str4 = "<font color=" + ((signInContentByGeneralId.Status == SignInStatus.NotSignIn) ? "red" : "green") + ">[" + BasePage.EnumToHtml <SignInStatus>(signInContentByGeneralId.Status) + "]</font>"; label2.Text = "<a href='' onclick='return false' title='要求签收用户:" + signInUsers + " 已经签收用户:" + sb.ToString() + " 尚未签收用户:" + builder2.ToString() + "'>" + str4 + "</a>"; } HyperLink link2 = e.Row.FindControl("HypTitle") as HyperLink; length = 0x25 - length; link2.Text = StringHelper.SubString(dataItem.Title, length, "..."); link2.ToolTip = dataItem.Title; link2.NavigateUrl = "ContentView.aspx?GeneralID=" + dataItem.GeneralId.ToString(); HyperLink link3 = (HyperLink)e.Row.FindControl("EahContentModify"); link3.NavigateUrl = "Content.aspx?Action=Modify&GeneralID=" + dataItem.GeneralId.ToString() + "&NodeID=" + dataItem.NodeId.ToString(); if (!this.m_Administrator) { string checkStr = nodeId.ToString(); if (cacheNodeById.IsNull) { cacheNodeById = Nodes.GetCacheNodeById(nodeId); } if (cacheNodeById.ParentId > 0) { checkStr = checkStr + "," + cacheNodeById.ParentPath; } if (!StringHelper.FoundCharInArr(checkStr, this.m_arrContentNodeIdManage)) { ((HyperLink)e.Row.FindControl("EahContentModify")).Enabled = false; ((LinkButton)e.Row.FindControl("ELbtnDelete")).Enabled = false; } } } }
public void Step3_Compare( AeroNavigationBar.HistoryInfo History, LinkImage[] Source, ComparisionInfo[] Comparision, ComparisionValue[] Values) { History.AddFrame( delegate { var Current = Comparision.Where(k => k.WaitingForUser && k.Value == null).FirstOrDefault(); var MatrixButton = new TextButtonControl { Text = ">> Show the matrix", Width = 400, Height = 40, }.AttachContainerTo(this).MoveContainerTo(350, 100 + 40 * 10); MatrixButton.Content.FontSize = 20; var MatrixButton_bg = MatrixButton.Background.ToAnimatedOpacity(); MatrixButton.Background.Fill = Brushes.White; MatrixButton_bg.Opacity = 0; MatrixButton.Overlay.MouseEnter += delegate { MatrixButton_bg.Opacity = 1; }; MatrixButton.Overlay.MouseLeave += delegate { MatrixButton_bg.Opacity = 0; }; MatrixButton.Click += delegate { Step4_ShowMatrix(History, Source, Comparision, Values); }; if (Current == null) { this.Title.Text = "You are done!"; var MistakeMatrixButton = new TextButtonControl { Text = ">> Show the mistake matrix", Width = 400, Height = 40, }.AttachContainerTo(this).MoveContainerTo(350, 100 + 40 * 9); MistakeMatrixButton.Content.FontSize = 20; var MistakeMatrixButton_bg = MistakeMatrixButton.Background.ToAnimatedOpacity(); MistakeMatrixButton.Background.Fill = Brushes.White; MistakeMatrixButton_bg.Opacity = 0; MistakeMatrixButton.Overlay.MouseEnter += delegate { MistakeMatrixButton_bg.Opacity = 1; }; MistakeMatrixButton.Overlay.MouseLeave += delegate { MistakeMatrixButton_bg.Opacity = 0; }; MistakeMatrixButton.Click += delegate { Step5_ShowMistakeMatrix(History, Source, Comparision, Values); }; var RestartButton = new TextButtonControl { Text = ">> Restart", Width = 400, Height = 40, }.AttachContainerTo(this).MoveContainerTo(350, 100 + 40 * 11); RestartButton.Content.FontSize = 20; var RestartButton_bg = RestartButton.Background.ToAnimatedOpacity(); RestartButton.Background.Fill = Brushes.White; RestartButton_bg.Opacity = 0; RestartButton.Overlay.MouseEnter += delegate { RestartButton_bg.Opacity = 1; }; RestartButton.Overlay.MouseLeave += delegate { RestartButton_bg.Opacity = 0; }; RestartButton.Click += delegate { Step1_ChooseImageSet(History, DefaultDataSets); }; // step 1 - each row gets a geomean and is seen as a new column var GeomeanColumn = Enumerable.Range(0, Source.Length).ToArray( i => Comparision.Where(k => k.Y == i).Geomean(k => k.GetCurrentValue()) ); // step 2 - geomean gets a sum var GeomeanColumnSum = GeomeanColumn.Sum(); // step 3 - each column gets a sum //var SumRow = Enumerable.Range(0, Source.Length).ToArray( // i => Comparision.Where(k => k.X == i).Sum(k => k.GetCurrentValue()) //); // step 4 - calculate the weights for each row var GeomeanWeightColumn = GeomeanColumn.ToArray(k => k / GeomeanColumnSum); // step 5 - calculate max selfvalue //var MaxSelfValue = SumRow.MatrixMultiplication(GeomeanWeightColumn); var Sorted = GeomeanWeightColumn. Select((weight, i) => new { weight = 1 - weight, i, Source = Source[i] }). OrderBy(k => k.weight).Select((k, i) => new { k.weight, i, k.Source }).ToArray(); var DisposeSorted = new List<Action>(); foreach (var v in Sorted) { var k = v; var zoom = (0.5 + v.weight * 0.5) / 2.0; Console.WriteLine(new { v.i, zoom, v.weight }.ToString()); v.Source.ClickEnabled = false; v.Source.SizeTo(zoom); var k_x = 500 + Convert.ToInt32(-30 * v.i * zoom) * v.i; var k_y = 100 + Convert.ToInt32(70 * v.i * zoom); v.Source.MoveContainerTo(k_x, k_y); v.Source.AttachContainerTo(this); var k_Text = new TextBox { Background = Brushes.Black, Width = 60, Height = 22, Foreground = Brushes.Yellow, BorderThickness = new Thickness(0), Text = "" + v.weight, IsReadOnly = true }; bool MouseEnterDisabled = false; MouseEventHandler MouseEnter = delegate { // cannot remove event from MouseEnter yet if (MouseEnterDisabled) return; k.Source.BringContainerToFront(); k_Text.BringToFront(); }; k.Source.Overlay.MouseEnter += MouseEnter; k_Text.MoveTo(k_x - 30, k_y - 11).AttachTo(this); DisposeSorted.Add( delegate { k.Source.OrphanizeContainer(); k_Text.Orphanize(); MouseEnterDisabled = true; } ); } MatrixButton.BringContainerToFront(); MistakeMatrixButton.BringContainerToFront(); return delegate { this.Title.Text = "..."; DisposeSorted.ToArray().ForEach(h => h()); MatrixButton.OrphanizeContainer(); MistakeMatrixButton.OrphanizeContainer(); RestartButton.OrphanizeContainer(); }; } else { var More = Comparision.Count(k => k.WaitingForUser && k.Value == null); this.Title.Text = "Compare images #" + (1 + Current.X) + " above and #" + (1 + Current.Y) + " below. You have " + More + " image pairs to compare..."; var X = Source[Current.X]; var Y = Source[Current.Y]; X.ClickEnabled = false; X.SizeTo(0.5).MoveContainerTo(100, 100).AttachContainerTo(this); Y.ClickEnabled = false; Y.SizeTo(0.5).MoveContainerTo(100, 300).AttachContainerTo(this); #region Options var Options = Values.Select( (Value, Index) => { var o7 = new TextButtonControl { Text = "above is " + Value.Name + " than below (" + Value.ToString() + ")", Width = 400, Height = 40, }.AttachContainerTo(this).MoveContainerTo(350, 100 + 40 * Index); o7.Content.FontSize = 20; var o7bg = o7.Background.ToAnimatedOpacity(); o7.Background.Fill = Brushes.White; o7bg.Opacity = 0; o7.Overlay.MouseEnter += delegate { o7bg.Opacity = 1; }; o7.Overlay.MouseLeave += delegate { o7bg.Opacity = 0; }; o7.Click += delegate { var NewComparision = Comparision.ToArray( o => { var n = new ComparisionInfo { WaitingForUser = o.WaitingForUser, Value = o.Value, X = o.X, Y = o.Y }; if (o == Current) { n.Value = Value; } if (o.Y == Current.X) if (o.X == Current.Y) { if (Value.InverseOf != null) n.Value = Value.InverseOf; else { var Inverse = Values.SingleOrDefault(k => k.InverseOf == Value); if (Inverse == null) n.Value = Value; else n.Value = Inverse; } } return n; } ); Step3_Compare(History, Source, NewComparision, Values); }; return o7; } ).ToArray(); #endregion return delegate { this.Title.Text = "..."; X.OrphanizeContainer(); Y.OrphanizeContainer(); Options.ForEach(k => k.OrphanizeContainer()); MatrixButton.OrphanizeContainer(); }; } } ); }