public override bool Equals(object obj) { ServerDescriptor other = obj as ServerDescriptor; if (obj == null) { return(false); } return(other == this); }
/// <summary> /// Shows an info dialog that the server with the given <see cref="sd"/> was attached. /// </summary> /// <param name="sd">Descriptor of the server whose information should be shown.</param> protected void ShowAttachInformationDialogAndClose(ServerDescriptor sd) { IScreenManager screenManager = ServiceRegistration.Get<IScreenManager>(); IDialogManager dialogManager = ServiceRegistration.Get<IDialogManager>(); _attachInfoDialogHandle = Guid.Empty; // Set this to value != null here to make the attachment dialog's close handler know we are not finished in our WF-state screenManager.CloseTopmostDialog(); string header = LocalizationHelper.Translate(Consts.RES_ATTACH_INFO_DIALOG_HEADER); string text = LocalizationHelper.Translate(Consts.RES_ATTACH_INFO_DIALOG_TEXT, sd.ServerName, sd.GetPreferredLink().HostName); Guid handle = dialogManager.ShowDialog(header, text, DialogType.OkDialog, false, DialogButtonType.Ok); lock (_syncObj) _attachInfoDialogHandle = handle; }
protected ListItem CreateServerItem(ServerDescriptor sd) { ListItem result = new ListItem(); SystemName system = sd.GetPreferredLink(); result.SetLabel(Consts.KEY_NAME, LocalizationHelper.Translate(Consts.RES_SERVER_FORMAT_TEXT, sd.ServerName, system.HostName)); result.SetLabel(Consts.KEY_SERVER_NAME, sd.ServerName); result.SetLabel(Consts.KEY_SYSTEM, system.HostName); result.AdditionalProperties[Consts.KEY_SERVER_DESCRIPTOR] = sd; result.Command = new MethodDelegateCommand(() => ChooseNewHomeServerAndClose(result)); return result; }
/// <summary> /// When a home server is connected, we store the connection data of the server to be able to /// provide the home server's data also when the connection is down. We'll refresh the data each time /// the server is connected to track changes in the server's location, name, ... /// </summary> protected static void SaveLastHomeServerData(ServerDescriptor serverDescriptor) { ISettingsManager settingsManager = ServiceRegistration.Get<ISettingsManager>(); ServerConnectionSettings settings = settingsManager.Load<ServerConnectionSettings>(); settings.LastHomeServerName = serverDescriptor.ServerName; settings.LastHomeServerSystem = serverDescriptor.GetPreferredLink(); settingsManager.Save(settings); }