internal override void FromCofigFavorite(IFavorite destination, FavoriteConfigurationElement source) { this.SSH1 = source.SSH1; this.AuthMethod = source.AuthMethod; this.CertificateKey = source.KeyTag; this.SSHKeyFile = source.SSHKeyFile; }
/// <summary> /// Creates deep copy of provided favorite in persistence including its toolbar button and groups memebership. /// The copy is already added to the persistence. /// Returns newly created favorite copy if operation was successfull; otherwise null. /// </summary> internal IFavorite Copy(IFavorite favorite) { if (favorite == null) return null; return this.CopyUsingPrompt(favorite); }
internal override void ToConfigFavorite(IFavorite source, FavoriteConfigurationElement destination) { destination.SSH1 = this.SSH1; destination.AuthMethod = this.AuthMethod; destination.KeyTag = this.CertificateKey; destination.SSHKeyFile = this.SSHKeyFile; }
public void LoadFrom(IFavorite favorite) { this.FillDisplayControls(favorite); var rdpOptions = favorite.ProtocolProperties as RdpOptions; if (rdpOptions != null) this.FillRdpDisplayControls(rdpOptions); }
public static Size GetSize(Connection connection, IFavorite favorite) { int height = favorite.Display.Height; int width = favorite.Display.Width; switch (favorite.Display.DesktopSize) { case DesktopSize.x640: return new Size(640, 480); case DesktopSize.x800: return new Size(800, 600); case DesktopSize.x1024: return new Size(1024, 768); case DesktopSize.x1152: return new Size(1152, 864); case DesktopSize.x1280: return new Size(1280, 1024); case DesktopSize.FullScreen: width = Screen.FromControl(connection).Bounds.Width - 13; height = Screen.FromControl(connection).Bounds.Height - 1; return GetMaxAvailableSize(width, height); case DesktopSize.FitToWindow: case DesktopSize.AutoScale: width = connection.Parent.Width; height = connection.Parent.Height; return GetMaxAvailableSize(width, height); default: return new Size(width, height); } }
public NewTerminalForm(IPersistence persistence, IFavorite favorite) : this() { this.persistence = persistence; this.InitializeFavoritePropertiesControl(); this.Init(favorite, String.Empty); }
public void SaveTo(IFavorite favorite) { this.FillFavoriteDisplayOptions(favorite); var rdpOptions = favorite.ProtocolProperties as RdpOptions; if (rdpOptions != null) this.FillFavoriteRdpDisplayOptions(rdpOptions); }
public void CheckForTerminalServer(IFavorite favorite) { if (favorite.Protocol == ConnectionManager.RDP) ThreadPool.QueueUserWorkItem(new WaitCallback(this.CheckForTS), favorite); this.IsTerminalServer = false; }
private void FillDisplayControls(IFavorite favorite) { this.cmbResolution.SelectedIndex = (Int32)favorite.Display.DesktopSize; this.cmbColors.SelectedIndex = (Int32)favorite.Display.Colors; this.widthUpDown.Value = favorite.Display.Width; this.heightUpDown.Value = favorite.Display.Height; }
internal void LoadFrom(IFavorite favorite) { foreach (var protocolControl in this.Controls.OfType<IProtocolOptionsControl>()) { protocolControl.LoadFrom(favorite); } }
internal static ValidationStates Validate(IFavorite favorite) { List<ValidationState> results = ValidateObject(favorite); var executeResults = ValidateObject(favorite.ExecuteBeforeConnect); results.AddRange(executeResults); return new ValidationStates(results); }
private IFavorite CopyUsingPrompt(IFavorite favorite) { InputBoxResult result = this.copyPrompt(); if (result.ReturnCode == DialogResult.OK && !string.IsNullOrEmpty(result.Text)) return this.CopySelectedFavorite(favorite, result.Text); return null; }
public void InitializeFavorites() { this.AddFavorite(ORIGINAL_NAME); this.copy = this.AddFavorite(COPY_NAME); // command is set to rename by default var service = new TestRenameService(this.Persistence.Favorites, newName => true); this.command = new FavoriteRenameCommand(this.Persistence, service); }
public void LoadFrom(IFavorite favorite) { this.chkExecuteBeforeConnect.Checked = favorite.ExecuteBeforeConnect.Execute; this.txtCommand.Text = favorite.ExecuteBeforeConnect.Command; this.txtArguments.Text = favorite.ExecuteBeforeConnect.CommandArguments; this.txtInitialDirectory.Text = favorite.ExecuteBeforeConnect.InitialDirectory; this.chkWaitForExit.Checked = favorite.ExecuteBeforeConnect.WaitForExit; }
private static void ConvertDisplay(FavoriteConfigurationElement result, IFavorite sourceFavorite) { IDisplayOptions display = sourceFavorite.Display; result.Colors = display.Colors; result.DesktopSize = display.DesktopSize; result.DesktopSizeWidth = display.Width; result.DesktopSizeHeight = display.Height; }
public void LoadFrom(IFavorite favorite) { var rdpOptions = favorite.ProtocolProperties as RdpOptions; if (rdpOptions == null) return; FillTsGatewayControls(rdpOptions); }
internal static void AddFavoriteIntoGroups(IPersistence persistence, IFavorite toPerisist, IEnumerable<string> validGroupNames) { foreach (string groupName in validGroupNames) { IGroup group = FavoritesFactory.GetOrAddNewGroup(persistence, groupName); group.AddFavorite(toPerisist); } }
public void SaveTo(IFavorite favorite) { var rdpOptions = favorite.ProtocolProperties as RdpOptions; if (rdpOptions == null) return; FillFavoriteTSgatewayOptions(rdpOptions); }
public void Add(IFavorite favorite) { if (AddToCache(favorite)) { this.dispatcher.ReportFavoriteAdded(favorite); this.persistence.SaveImmediatelyIfRequested(); } }
private static void ConvertDisplay(IFavorite result, FavoriteConfigurationElement sourceFavorite) { IDisplayOptions display = result.Display; display.Colors = sourceFavorite.Colors; display.DesktopSize = sourceFavorite.DesktopSize; display.Width = sourceFavorite.DesktopSizeWidth; display.Height = sourceFavorite.DesktopSizeHeight; }
internal static void UpdateFavoriteUrl(IFavorite destination, string newAbsoluteUrl) { var webOptions = destination.ProtocolProperties as WebOptions; if (webOptions != null) { webOptions.UpdateMyFavoriteUrl(destination, newAbsoluteUrl); } }
public void LoadFrom(IFavorite favorite) { VncOptions vncOptions = favorite.ProtocolProperties as VncOptions; if (vncOptions == null) return; this.vncAutoScaleCheckbox.Checked = vncOptions.AutoScale; this.vncDisplayNumberInput.Value = vncOptions.DisplayNumber; this.VncViewOnlyCheckbox.Checked = vncOptions.ViewOnly; }
private static void ConvertBeforeConnetExecute(FavoriteConfigurationElement result, IFavorite sourceFavorite) { IBeforeConnectExecuteOptions executeOptions = sourceFavorite.ExecuteBeforeConnect; result.ExecuteBeforeConnect = executeOptions.Execute; result.ExecuteBeforeConnectCommand = executeOptions.Command; result.ExecuteBeforeConnectArgs = executeOptions.CommandArguments; result.ExecuteBeforeConnectInitialDirectory = executeOptions.InitialDirectory; result.ExecuteBeforeConnectWaitForExit = executeOptions.WaitForExit; }
internal static Image GetFavoriteIcon(IFavorite favorite) { if (String.IsNullOrEmpty(favorite.ToolBarIconFile)) { return GetProtocolImage(favorite); } return LoadImage(favorite.ToolBarIconFile, Resources.smallterm); }
public void LoadFrom(IFavorite favorite) { var vncOptions = favorite.ProtocolProperties as VMRCOptions; if (vncOptions == null) return; this.VMRCAdminModeCheckbox.Checked = vncOptions.AdministratorMode; this.VMRCReducedColorsCheckbox.Checked = vncOptions.ReducedColorsMode; }
private void AddIfValid(IFavorite favorite, string newName) { this.favorites.Add(favorite); this.favorites.UpdateFavorite(favorite, this.source.Groups); var settings = Settings.Instance; if (settings.HasToolbarButton(this.source.Id)) settings.AddFavoriteButton(favorite.Id); }
public void SaveTo(IFavorite favorite) { var vmrcOptions = favorite.ProtocolProperties as VMRCOptions; if (vmrcOptions == null) return; vmrcOptions.AdministratorMode = this.VMRCAdminModeCheckbox.Checked; vmrcOptions.ReducedColorsMode = this.VMRCReducedColorsCheckbox.Checked; }
private static void ConvertBeforeConnetExecute(IFavorite result, FavoriteConfigurationElement sourceFavorite) { IBeforeConnectExecuteOptions executeOptions = result.ExecuteBeforeConnect; executeOptions.Execute = sourceFavorite.ExecuteBeforeConnect; executeOptions.Command = sourceFavorite.ExecuteBeforeConnectCommand; executeOptions.CommandArguments = sourceFavorite.ExecuteBeforeConnectArgs; executeOptions.InitialDirectory = sourceFavorite.ExecuteBeforeConnectInitialDirectory; executeOptions.WaitForExit = sourceFavorite.ExecuteBeforeConnectWaitForExit; }
public void SaveTo(IFavorite favorite) { IBeforeConnectExecuteOptions exucutionOptions = favorite.ExecuteBeforeConnect; exucutionOptions.Execute = this.chkExecuteBeforeConnect.Checked; exucutionOptions.Command = this.txtCommand.Text; exucutionOptions.CommandArguments = this.txtArguments.Text; exucutionOptions.InitialDirectory = this.txtInitialDirectory.Text; exucutionOptions.WaitForExit = this.chkWaitForExit.Checked; }
public void RecordHistoryItem(IFavorite favorite) { var historyTarget = favorite as DbFavorite; if (historyTarget == null) return; // here we don't cache today's items, we always load the current state from database AddToDatabase(historyTarget); }
/// <summary> /// Creates new instance of parameters required to open new connection /// </summary> /// <param name="favorite">Not null favorite, where to connect</param> /// <param name="forceConsole">For RDP only. If defined, will replace the RDP Console option</param> /// <param name="forceNewWindow">If defined, will replace the favorite option to open connection in new window</param> /// <param name="credentials">If defined, replaces the favorite authentication informations</param> internal ConnectionDefinition(IFavorite favorite, bool?forceConsole = null, bool?forceNewWindow = null, ICredentialSet credentials = null) : this(new List <IFavorite>() { favorite }, forceConsole, forceNewWindow, credentials) { }
internal void Connect(IFavorite favorite) { var definition = new ConnectionDefinition(favorite); this.Connect(definition); }
internal static bool ContainsFavoriteNode(TreeNodeCollection nodes, IFavorite favorite) { return(FilterFavoriteNodes(nodes).Any(node => node.Favorite.StoreIdEquals(favorite))); }
private GuardedSecurity CreateGuardedSecurity(IFavorite favorite) { return(new GuardedSecurity(this.SecondaryPersistence, favorite.Security)); }
private void OverwriteByConflictingName(string newName, IFavorite oldFavorite, IFavorite editedFavorite) { this.persistence.StartDelayedUpdate(); // remember the edited favorite groups, because delete may also delete its groups, // if it is the last favorite in the group List <IGroup> groups = editedFavorite.Groups; editedFavorite.Name = newName; oldFavorite.UpdateFrom(editedFavorite); this.favorites.Update(oldFavorite); this.favorites.UpdateFavorite(oldFavorite, groups); this.favorites.Delete(editedFavorite); this.persistence.SaveAndFinishDelayedUpdate(); }
private void SheduleRename(IFavorite favorite, string newName) { var favoriteArguments = new object[] { favorite, newName }; this.favsTree.BeginInvoke(new Action <IFavorite, string>(this.ApplyRename), favoriteArguments); }
private void FillDescriptionProperties(IFavorite favorite) { favorite.NewWindow = this.NewWindowCheckbox.Checked; this.favorites.UpdateFavoriteIcon(favorite, this.currentToolBarFileName); }
private static void ConvertGeneralProperties(FavoriteConfigurationElement result, IFavorite sourceFavorite) { result.Name = sourceFavorite.Name; result.Protocol = sourceFavorite.Protocol; result.Port = sourceFavorite.Port; result.ServerName = sourceFavorite.ServerName; result.Url = UrlConverter.ExtractAbsoluteUrl(sourceFavorite); // stoping the backward compatibility: result.ToolBarIcon = sourceFavorite.ToolBarIconFile; result.NewWindow = sourceFavorite.NewWindow; result.DesktopShare = sourceFavorite.DesktopShare; result.Notes = sourceFavorite.Notes; }
private static void ConvertGroups(FavoriteConfigurationElement result, IFavorite sourceFavorite) { var groupNames = sourceFavorite.Groups.Select(group => group.Name).ToArray(); result.Tags = string.Join(",", groupNames); }
internal void InsertFavorite(IFavorite favorite) { int insertIndex = this.FindFavoriteNodeInsertIndex(favorite); this.AddFavoriteNode(favorite, insertIndex); }
public void FillFavoriteFromControls(IFavorite favorite) { this.favoritePropertiesControl1.SaveTo(favorite); }
public int CompareTo(IFavorite other) { return(string.Compare(this.UserChosenName, other.UserChosenName, StringComparison.Ordinal)); }
/// <summary> /// More regression test than unit test /// </summary> internal static void ExportImportFavorite(IPersistence persistence, string path) { IFavorite importedFavorite = PerformImportExportFavorite(persistence, path); AssertSecurityImported(persistence, importedFavorite.Security); }
internal bool ContainsFavoriteNode(IFavorite favorite) { return(ContainsFavoriteNode(this.nodes, favorite)); }
private void ApplyRename(IFavorite favorite, string newName) { this.renameCommand.ApplyRename(favorite, newName); this.isRenaming = false; }
private void SaveAndReportFavoriteUpdate(IFavorite favorite) { this.dispatcher.ReportFavoriteUpdated(favorite); this.persistence.SaveImmediatelyIfRequested(); }
private void FillDescriptionPropertiesControls(IFavorite favorite) { this.NewWindowCheckbox.Checked = favorite.NewWindow; this.chkAddtoToolbar.Checked = settings.HasToolbarButton(favorite.Id); this.pictureBox2.Image = this.favorites.LoadFavoriteIcon(favorite); }
private static Size CalculateDefaultSize(IFavorite favorite) { IDisplayOptions display = favorite.Display; return(new Size(display.Width, display.Height)); }
public FavoriteController(IFavorite fav_) { favoriteService = fav_; }
public void UpdateFavoriteIcon(IFavorite favorite, string imageFilePath) { var toUpdate = favorite as Favorite; toUpdate.ToolBarIconFile = imageFilePath; }
internal TabControlItem FindAttachedTab(IFavorite updated) { return(this.tabControl.Items.Cast <TerminalTabControlItem>() .FirstOrDefault(tab => tab.OriginFavorite != null && tab.OriginFavorite.StoreIdEquals(updated))); }
private bool IsNotCached(IFavorite favorite) { return(favorite == null || !this.cache.ContainsKey(favorite.Id)); }
internal Image LoadImage(string value, IFavorite favorite) { var imageData = LoadImage(value); return(this.LoadImage(imageData, favorite)); }
public void SaveTo(IFavorite favorite) { this.FillGeneralProrperties(favorite); this.securityPanel1.SaveTo(favorite.Security, this.chkSavePassword.Checked); this.FillDescriptionProperties(favorite); }
private void DataGridFavorites_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { this.editedFavorite = this.GetSelectedFavorite(); this.editedFavoriteName = this.editedFavorite.Name; }
internal async Task ConnectAsync(IFavorite favorite) { var definition = new ConnectionDefinition(favorite); await this.ConnectAsync(definition); }
private NewTerminalForm CreateFavoriteForm(IFavorite favorite) { return new NewTerminalForm(this.persistence, this.connectionManager, this.favoriteIcons, favorite); }
public NewTerminalForm(IPersistence persistence, ConnectionManager connectionManager, FavoriteIcons favoriteIcons, IFavorite favorite) : this(persistence, connectionManager, favoriteIcons) { this.Init(favorite); }
public ArgumentsBuilder(IGuardedSecurity credentials, IFavorite favorite) { this.credentials = credentials; this.favorite = favorite; }