public void TestCreateTable() { try { Inspector.Clear(); var specService = new SpecService(new SpecTest()); specService.CreateSpec(); } catch (System.Exception ex) { Application.ShowAlertDialog(ex.Message); } TrayItemBubbleWindow bubble = new TrayItemBubbleWindow(); bubble.IconType = IconType.Warning; bubble.Text = "BubleText"; bubble.Text2 = "BubleText2"; bubble.Title = "BubleTitle"; TrayItem itemTray = new TrayItem(); itemTray.Icon = System.Drawing.SystemIcons.Warning; itemTray.ToolTipText = "ToolTipText"; itemTray.ShowBubbleWindow(bubble); Application.StatusBar.TrayItems.Add(itemTray); Application.StatusBar.Update(); if (Inspector.HasErrors) { Inspector.Show(); } }
void Application_Idle(object sender, EventArgs e) { if (sb.Length != 0) { Document doc = Application.DocumentManager.MdiActiveDocument; TrayItem ti = new TrayItem(); ti.ToolTipText = "Йо!"; ti.Icon = doc.GetStatusBar().TrayItems[0].Icon; Application.StatusBar.TrayItems.Add(ti); Application.StatusBar.Update(); ti.CloseBubbleWindows(); TrayItemBubbleWindow bw = new TrayItemBubbleWindow(); bw.Title = "Хей хо!"; bw.Text = sb.ToString(); bw.IconType = IconType.Information; ti.ShowBubbleWindow(bw); bw.Closed += delegate { CloseBw(ti); }; } Application.Idle -= notifyHandler; sb.Clear(); notifyHandler = null; }
public void StatusBarBalloon() { Document doc = Application.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; ObjectId id = ed.GetEntity("请选择需要改变颜色的对象").ObjectId; TrayItem trayItem = new TrayItem { ToolTipText = "change color of Entity" }; //trayItem.Icon = doc.StatusBar.TrayItems[0].Icon;//有问题报错 Application.StatusBar.TrayItems.Add(trayItem); TrayItemBubbleWindow window = new TrayItemBubbleWindow { Title = "change color of Entity", HyperText = "对象颜色修改为红色", Text = "点击改变对象的颜色", IconType = IconType.Information }; trayItem.ShowBubbleWindow(window); Application.StatusBar.Update(); window.Closed += (sender, e) => { if (e.CloseReason == TrayItemBubbleWindowCloseReason.HyperlinkClicked) { using (doc.LockDocument()) using (Transaction trans = doc.TransactionManager.StartTransaction()) { Entity ent = (Entity)trans.GetObject(id, OpenMode.ForWrite); ent.ColorIndex = 1; trans.Commit(); } } Application.StatusBar.TrayItems.Remove(trayItem); Application.StatusBar.Update(); }; }
public static void StatusBarBalloon(string category, string title) { const string appName = "PGA TOUR CivTinSurface Notification"; Document doc = ACADDOC.Application.DocumentManager.MdiActiveDocument; var statusBar = doc.GetStatusBar(); TrayItem ti = new TrayItem(); ti.ToolTipText = appName; ti.Icon = statusBar.TrayItems[0].Icon; statusBar.TrayItems.Add(ti); TrayItemBubbleWindow bw = new TrayItemBubbleWindow(); bw.Title = title; //bw.HyperText = htext; //bw.HyperLink = hlink; bw.Text = title; bw.Text2 = String.Format("Finishing {0}", category); bw.IconType = IconType.Information; ti.ShowBubbleWindow(bw); statusBar.Update(); bw.Closed += delegate( object o, TrayItemBubbleWindowClosedEventArgs args ) { // Use a try-catch block, as an exception // will occur when AutoCAD is closed with // one of our bubbles open try { statusBar.TrayItems.Remove(ti); statusBar.Update(); } catch { } }; }