private void btnOK_Click(object sender, EventArgs e) { if ((this.rdoResourceUse.SelectedIndex == 1) && (this.ResourcescheckedListBox.CheckedItems.Count == 0)) { MessageBox.Show("请选择所用资源!"); } else { new AGSServerConnectionFactoryClass(); IPropertySet set = this.method_5(); IAGSServerConnectionName name = new AGSServerConnectionNameClass { ConnectionProperties = set }; try { IAGSServerConnection connection = (name as IName).Open() as IAGSServerConnection; if (connection == null) { return; } } catch (Exception exception) { MessageBox.Show(exception.ToString()); return; } string path = Environment.SystemDirectory.Substring(0, 2) + @"\Documents and Settings\Administrator\Application Data\ESRI\ArcCatalog\"; if (Directory.Exists(path)) { string str2 = path + this.txtServer.Text + ".ags"; str2 = this.method_4(str2); IGxAGSConnection connection2 = new GxAGSConnection(); object obj2 = null; if ((this.rdoResourceUse.SelectedIndex == 1) && (this.ResourcescheckedListBox.CheckedItems.Count > 0)) { string[] strArray = new string[this.ResourcescheckedListBox.CheckedItems.Count]; for (int i = 0; i < this.ResourcescheckedListBox.CheckedItems.Count; i++) { strArray[i] = this.ResourcescheckedListBox.CheckedItems[i].ToString(); } obj2 = strArray; } connection2.AGSServerConnectionName = name; connection2.SelectedServerObjects = obj2; connection2.SaveToFile(str2); this.igxObject_0 = connection2 as IGxObject; } base.DialogResult = DialogResult.OK; base.Close(); } }
private void btnOK_Click(object sender, EventArgs e) { if (this.txtTempFolder.Text.Trim().Length == 0) { MessageBox.Show("请输入过渡文件夹"); } else { string path = Environment.SystemDirectory.Substring(0, 2) + @"\Users\Administrator\AppData\Roaming\ESRI\Desktop10.2\ArcCatalog\"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string text = this.txtMUrl.Text; if (text.IndexOf("http://") == 0) { text = text.Substring(7); } else { this.txtMUrl.Text = "http://" + this.txtMUrl.Text; } string[] strArray = text.Split(new char[] { '/' }); IAGSServerConnectionFactory factory = new AGSServerConnectionFactoryClass(); IPropertySet pConnectionProperties = this.method_2(this.ConnectionFile, strArray[0]); IAGSServerConnection connection = null; try { connection = factory.Open(pConnectionProperties, 0); if (connection == null) { return; } } catch (Exception exception) { MessageBox.Show(exception.ToString()); return; } if (Directory.Exists(path)) { IGxAGSConnection connection2 = new GxAGSConnection { AGSServerConnectionName = connection.FullName as IAGSServerConnectionName }; connection2.SaveToFile(this.ConnectionFile); this.igxObject_0 = connection2 as IGxObject; } base.DialogResult = DialogResult.OK; } }
private void btnOK_Click(object sender, EventArgs e) { if (((this.radioGroup1.SelectedIndex >= 1) && !this.chkUseDefaultFolder.Checked) && (this.txtTempFolder.Text.Trim().Length == 0)) { MessageBox.Show("请输入过渡文件夹"); } else { IPropertySet set; object obj2; object obj3; string path = Environment.SystemDirectory.Substring(0, 2) + @"\Users\Administrator\AppData\Roaming\ESRI\Desktop10.2\ArcCatalog\"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string str2 = ""; string text = ""; if (this.radioGroup1.SelectedIndex == 0) { text = this.txtServer.Text; } else { text = this.txtMUrl.Text; } string str4 = ""; if (this.radioGroup1.SelectedIndex == 0) { str4 = "(用户)"; } else if (this.radioGroup1.SelectedIndex == 1) { str4 = "(系统管理员)"; } else if (this.radioGroup1.SelectedIndex == 2) { str4 = "(发布者)"; } if (text.IndexOf("http://") == 0) { text = text.Substring(7); } else { this.txtServer.Text = "http://" + this.txtServer.Text; } string[] strArray = text.Split(new char[] { '/' }); string str5 = strArray[0]; if (strArray.Length > 0) { str2 = path + "arcgis on" + strArray[0].Replace(":", "_") + str4 + ".ags"; } else { str2 = path + "arcgis on" + str4 + ".ags"; } str2 = this.method_1(str2); IAGSServerConnectionFactory factory = new AGSServerConnectionFactoryClass(); if (this.radioGroup1.SelectedIndex == 0) { set = this.method_2(str2, str5); } else { set = this.method_3(str2, str5); } set.GetAllProperties(out obj2, out obj3); IAGSServerConnection connection = null; try { connection = factory.Open(set, 0); if (connection == null) { return; } } catch (Exception exception) { MessageBox.Show(exception.ToString()); return; } if (Directory.Exists(path)) { IGxAGSConnection connection2 = new GxAGSConnection { AGSServerConnectionName = connection.FullName as IAGSServerConnectionName }; connection2.SaveToFile(str2); this.igxObject_0 = connection2 as IGxObject; } base.DialogResult = DialogResult.OK; } }