/// <summary> /// Retrieve the current WCF uri /// </summary> /// <param name="type"></param> /// <returns></returns> public Uri GetWcfUri(WcfType type) { return(configFile.GetWcfUri(type)); }
/// <summary> /// return the current URI /// </summary> /// <param name="bdg"></param> /// <returns></returns> public Uri GetWcfUri(WcfType bdg) { System.ServiceModel.Configuration.ServiceModelSectionGroup serviceModelSection = System.ServiceModel.Configuration.ServiceModelSectionGroup.GetSectionGroup(configuration); return(serviceModelSection.Client.Endpoints[WrapperEndpoint[bdg]].Address); }
/// <summary> /// Saving the new configuration /// </summary> private void saveConfiguration() { Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; DumpType dtype = DumpType.File; //default value String svalue = String.Empty; //define the way where the xml will be dropped WcfType binding = WcfType.NamedPipe; //default value if (!FileSelected && !MsmqSelected && !WcfSelected) { Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; MessageBox.Show(ResourceLogic.GetString(ResourceKeyName.SelectType)); return; } //retrieve the current dump layer if (FileSelected) { dtype = DumpType.File; svalue = FolderPath; //test if the folder exist if (!FileLogic.IsValidPathFolder(svalue)) { Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; MessageBox.Show(ResourceLogic.GetString(ResourceKeyName.ValidFolderPath)); return; } } if (MsmqSelected) { dtype = DumpType.Msmq; svalue = MsmqPath; if (!MsmqLayer.IsExist(svalue)) { Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; MessageBox.Show(ResourceLogic.GetString(ResourceKeyName.ValidMsmqPath)); return; } } if (WcfSelected) { dtype = DumpType.Wcf; svalue = WcfUri; if (!Enum.TryParse <WcfType>(SelectedBindingType, out binding)) { Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; MessageBox.Show(ResourceLogic.GetString(ResourceKeyName.ValidWcfBinding)); return; } if (String.IsNullOrEmpty(svalue)) { Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; MessageBox.Show(ResourceLogic.GetString(ResourceKeyName.ValidWcfUri)); return; } } _editor.updateConfigurationFile(dtype, svalue, binding); Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; if (dtype == DumpType.Wcf) { MessageBox.Show(String.Format(ResourceLogic.GetString(ResourceKeyName.WcfPortCreation), binding.ToString())); } //confguration is applied so just apply show mode ConfigChange = false; MessageBox.Show(ResourceLogic.GetString(ResourceKeyName.ConfigurationSaved)); }
/// <summary> /// update the endpoint uri in the configuration file only for WCF /// </summary> /// <param name="uri"></param> /// <param name="bindingType"></param> public void UpdateUri(Uri uri, WcfType bindingType) { System.ServiceModel.Configuration.ServiceModelSectionGroup serviceModelSection = System.ServiceModel.Configuration.ServiceModelSectionGroup.GetSectionGroup(configuration); serviceModelSection.Client.Endpoints[WrapperEndpoint[bindingType]].Address = uri; }