示例#1
0
    static void Main(string[] args)
    {
      try
      {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);

        var amlStudioStart = args.FirstOrDefault(a =>
          a.StartsWith("/amlstudio:", StringComparison.OrdinalIgnoreCase));

        _serverPort = FreeTcpPort();
        var config = new HostConfiguration();
        config.RewriteLocalhost = false;
        using (var host = new NancyHost(config, new Uri("http://localhost:" + _serverPort.ToString())))
        {
          host.Start();
          if (string.IsNullOrEmpty(amlStudioStart))
          {
            Application.Run(new AppContext(new EditorWindow()));
          }
          else
          {
            var connName = amlStudioStart.Substring(11);
            var conn = ConnectionManager.Current.Library.Connections.FirstOrDefault(c =>
              c.ConnectionName.Equals(connName, StringComparison.OrdinalIgnoreCase));
            var win = new EditorWindow();
            if (conn != null) win.SetConnection(conn);
            Application.Run(new AppContext(win));
          }
        }
      }
      catch (Exception ex)
      {
        MessageBox.Show(ex.ToString(), "Innovator Admin: Crash");
        File.WriteAllText(Path.Combine(Path.GetDirectoryName(AssemblyPath), "LastError.txt"), ex.ToString());
      }
    }
 public static IEnumerable<ItemReference> GetItems(Action<EditorWindow> setConn)
 {
   using (var dialog = new EditorWindow())
   {
     dialog.dgvItems.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
     dialog.tbcOutputView.TabsVisible = false;
     dialog.tbcOutputView.SelectedTab = dialog.pgTableOutput;
     dialog.PreferredMode = OutputType.Table;
     setConn(dialog);
     if (dialog.ShowDialog() == DialogResult.OK
       && dialog._outputSet.Tables[0].Columns.Contains(Extensions.AmlTable_TypeName)
       && dialog._outputSet.Tables[0].Columns.Contains("id"))
     {
       return dialog.dgvItems.SelectedRows
                    .OfType<DataGridViewRow>()
                    .Where(r => r.Index != r.DataGridView.NewRowIndex)
                    .Select(r => ((DataRowView)r.DataBoundItem).Row)
                    .Select(r => new ItemReference((string)r[Extensions.AmlTable_TypeName], (string)r["id"])
                    {
                      KeyedName = dialog._outputSet.Tables[0].Columns.Contains("keyed_name") ? (string)r["keyed_name"] : null
                    }).ToList();
     }
     return Enumerable.Empty<ItemReference>();
   }
 }
 private EditorWindow NewWindow()
 {
   var window = new EditorWindow();
   window.SetProxy(_proxy.Clone());
   window.SoapAction = this.SoapAction;
   window._disposeProxy = false;
   return window;
 }
示例#4
0
 public RecentDocItem(EditorWindow parent)
 {
   _parent = parent;
   this.Visible = false;
 }