示例#1
0
 public void ShowObject()
 {
     try
     {
         GObject obj = null;
         GLib    lib = Lib;
         using (WaitCursor wr = new WaitCursor(app, "Loading object..."))
         {
             DataGridCell       dc = dgSearch.CurrentCell;
             BindingManagerBase bm = dgSearch.BindingContext[dtSearch];
             if (bm.Count == 0 || bm.Current.GetType() != typeof(DataRowView))
             {
                 return;
             }
             DataRowView drv      = (DataRowView)bm.Current;
             int         objectId = (int)drv[ObjectField.Id.ToString()];
             int         rangeId  = (int)drv[ObjectField.RangeId.ToString()];
             obj = lib.GetObject(objectId, rangeId);
             if (obj == null)
             {
                 obj = lib.LoadObject(objectId);
             }
             if (obj != null)
             {
                 lib.Selection.Set(obj);
                 MapUserControl mapCtl = app.CurrentMapControl;
                 if (mapCtl != null)
                 {
                     mapCtl.Map.EnsureVisible(lib.Selection.Bounds);
                     mapCtl.Repaint();
                 }
             }
         }
         app.ShowProperties(obj);
         if (obj == null)
         {
             MessageBox.Show(Locale.Get("_objectsnotfound"));
         }
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }