// return true if the uri is different public bool StartPing() { lastPingTime = DateTime.Now; bool isNewUri = false; try { OperationalUIFacade facade = (OperationalUIFacade)OperationalInterface.ObjectDirectory.Resolve(name); string newUri = RemotingServices.GetObjectUri(facade); if (newUri != uri) { isNewUri = true; uri = newUri; if (responseStatus != ResponseStatus.Unknown) { responseStatus = ResponseStatus.Unknown; parent.OnPingCompleted(this); } } pingInvoker = facade.Ping; ThreadPool.QueueUserWorkItem(DoPing, pingInvoker); } catch (Exception) { if (responseStatus != ResponseStatus.Down) { responseStatus = ResponseStatus.Down; parent.OnPingCompleted(this); } } return(isNewUri); }
public bool IsSameUri() { try { OperationalUIFacade facade = (OperationalUIFacade)OperationalInterface.ObjectDirectory.Resolve(name); return(uri == RemotingServices.GetObjectUri(facade)); } catch (Exception) { responseStatus = ResponseStatus.Down; return(false); } }
public static bool Attach(string suffix, bool throwException) { operationalFacade = null; operationalUIFacade = null; if (suffix == null) { suffix = string.Empty; } try { operationalFacade = (OperationalFacade)od.Resolve("OperationalService" + suffix); operationalUIFacade = (OperationalUIFacade)od.Resolve("OperationalUIService" + suffix); DatasetSourceFacade dsfacade = operationalUIFacade.DatasetFacade; DataItemDescriptor[] dataItems = dsfacade.GetDataItems(); foreach (DataItemDescriptor item in dataItems) { if (!dataset.ContainsKey(item.Name)) { dataset.Add(item); } } dataset.AttachToSource(dsfacade); } catch (Exception) { operationalFacade = null; operationalUIFacade = null; if (throwException) { throw; } else { return(false); } } if (Attached != null) { Attached(null, new AttachEventArgs(string.IsNullOrEmpty(suffix) ? string.Empty : suffix.Substring(1))); } return(true); }