Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 29 additions & 20 deletions RemoteApplicationPublisher/RemoteAppEditWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public partial class RemoteAppEditWindow : Form
private RemoteApp RemoteApp = new RemoteApp();
private RemoteAppMainWindow _mainWindow;
private string RemoteAppOriginalPath = string.Empty;
private bool populatingEditDialog = false;

// Hard coded for now. This needs to be found dynamically.
private string remoteLauncher = @"C:\Program Files\OneIdentity\RemoteApp Launcher\OI-SG-RemoteApp-Launcher.exe";
Expand All @@ -32,7 +33,15 @@ public RemoteApp EditRemoteApp(RemoteApp selectedRemoteApp)
Text = "Properties of " + RemoteApp.Name;
Size = MinimumSize;
HelpSystem.SetupTips(this);

// LoadValues() may set checkBoxOILauncher.Checked to true, which will trigger checkBoxOILauncher_CheckedChanged.
// Method checkBoxOILauncher_CheckedChanged will change values in the edit dialog when checkBoxOILauncher gets checked.
// We don't want those values to change just because the edit dialog is raised. We temporarily set a bool here that
// we check within checkBoxOILauncher_CheckedChanged to avoid changing those values.
populatingEditDialog = true;
LoadValues();
populatingEditDialog = false;

var dlgResult = ShowDialog();
_mainWindow.ReloadApps();
Dispose();
Expand Down Expand Up @@ -68,10 +77,7 @@ private void SetToolTips()

public void LoadValues()
{

ShortNameText.Text = RemoteApp.Name;
CommandLineOptionCombo.SelectedIndex = RemoteApp.CommandLineOption;

FullNameText.Text = RemoteApp.FullName;
PathText.Text = RemoteApp.Path;
CommandLineText.Text = RemoteApp.CommandLine;
Expand Down Expand Up @@ -267,24 +273,27 @@ private void ShortNameText_TextChanged(object sender, EventArgs e)

private void checkBoxOILauncher_CheckedChanged(object sender, EventArgs e)
{
if (checkBoxOILauncher.Checked)
{
RemoteAppOriginalPath = PathText.Text;
PathText.Text = remoteLauncher;
CommandLineOptionCombo.SelectedIndex = 2;
CommandLineText.Text = string.Format(commandLineTemplate, RemoteAppOriginalPath);
}
else
{
var sra = new SystemRemoteApps();
var currentApp = sra.GetApp(ShortNameText.Text);
if (currentApp != null)
{
RemoteAppOriginalPath = currentApp.VPath;
if (!populatingEditDialog)
{
if (checkBoxOILauncher.Checked)
{
RemoteAppOriginalPath = PathText.Text;
PathText.Text = remoteLauncher;
CommandLineOptionCombo.SelectedIndex = 2;
CommandLineText.Text = string.Format(commandLineTemplate, RemoteAppOriginalPath);
}
else
{
var sra = new SystemRemoteApps();
var currentApp = sra.GetApp(ShortNameText.Text);
if (currentApp != null)
{
RemoteAppOriginalPath = currentApp.VPath;
}
PathText.Text = RemoteAppOriginalPath;
CommandLineOptionCombo.SelectedIndex = 1;
CommandLineText.Text = string.Empty;
}
PathText.Text = RemoteAppOriginalPath;
CommandLineOptionCombo.SelectedIndex = 1;
CommandLineText.Text = string.Empty;
}

PathText.Enabled = !checkBoxOILauncher.Checked;
Expand Down