protected void DeleteButton_Click(object sender, EventArgs e)
 {
     Agent.GhostCastManagerClient gcmc = new Agent.GhostCastManagerClient();
     Status.Text = gcmc.DeleteSavedSessionByName(SavedSessionsListBox.SelectedValue);
     SavedSessionListBoxSelectedIndex = 0;
     SavedSessionsListBox.DataBind();
 }
 private void GhostCastSessionList_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     Agent.GhostCastManagerClient gcmc = new Agent.GhostCastManagerClient();
     switch (e.CommandName)
     {
         case "Clients":
             {
                 GridView list = (GridView)e.Item.FindControl("ConnectedClientsGridView");
                 list.Visible = true;
                 break;
             }
         case "Send":
             {
                 Status.Text = gcmc.SendGhostCastSession(Convert.ToInt32(e.CommandArgument));
                 this.ViewState["ClientListVisible"] = null;
                 break;
             }
         case "Close":
             {
                 Status.Text = gcmc.CloseGhostCastSession(Convert.ToInt32(e.CommandArgument));
                 RefreshSessions(false);
                 this.ViewState["ClientListVisible"] = null;
                 break;
             }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            Agent.GhostCastManagerClient gcmc = new Agent.GhostCastManagerClient();
            SiteLabel.Text = gcmc.GetAgentSettings().PhysicalSiteName;

            if (Tools.IsAdmin(AdminKeyTextBox, Session))
            {
                AdminViewState();
            }
        }
 protected void SaveButton_Click(object sender, EventArgs e)
 {
     agentSettings.PhysicalSiteName = PhysicalSiteNameTextBox.Text;
     agentSettings.GhostCastServerExePath = GhostCastServerExePathTextBox.Text;
     agentSettings.GhostImageFileRootPathPrimary = GhostImageFileRootPathPrimaryTextBox.Text;
     agentSettings.GhostImageFileRootPathSecondary = GhostImageFileRootPathSecondaryTextBox.Text;
     agentSettings.SMTPServerAddress = SMTPServerAddressTextBox.Text;
     Agent.GhostCastManagerClient gcmc = new Agent.GhostCastManagerClient();
     Status.Text = gcmc.SetAgentSettings(agentSettings);
 }
 protected void LaunchSessionButton_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrWhiteSpace(PartitionNoPrimaryTextBox.Text) ||
         String.IsNullOrWhiteSpace(PartitionNoSecondaryTextBox.Text))
     {
         Status.Text = "Please select 'Disk' or enter a partition number greater than 0.";
         return;
     }
     Agent.GhostCastManagerClient gcmc = new Agent.GhostCastManagerClient();
     Agent.GhostCastServerOptions serverOptions = GetDetailsFromForm();
     gcmc.SaveSession(serverOptions);
     Status.Text = gcmc.LaunchGhostCastSession(serverOptions.Name, AlertEmailAddressTextBox.Text);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     Status.Text = String.Empty;
     SavedSessionsListBox.DataBound += new EventHandler(SavedSessionsListBox_DataBound);
     if (Tools.IsAdmin(Master, Session))
     {
         DeleteButtonPanel.Visible = true;
     }
     Agent.GhostCastManagerClient gcmc = new Agent.GhostCastManagerClient();
     if (String.IsNullOrWhiteSpace(gcmc.GetAgentSettings().SMTPServerAddress))
     {
         AlertEmailAddressTextBox.Enabled = false;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Tools.IsAdmin(Master, Session))
            {
                Response.Redirect("Default.aspx", true);
                return;
            }

            Agent.GhostCastManagerClient gcmc = new Agent.GhostCastManagerClient();
            agentSettings = gcmc.GetAgentSettings();

            if (!Page.IsPostBack)
            {
                PhysicalSiteNameTextBox.Text = agentSettings.PhysicalSiteName;
                GhostCastServerExePathTextBox.Text = agentSettings.GhostCastServerExePath;
                GhostImageFileRootPathPrimaryTextBox.Text = agentSettings.GhostImageFileRootPathPrimary;
                GhostImageFileRootPathSecondaryTextBox.Text = agentSettings.GhostImageFileRootPathSecondary;
                SMTPServerAddressTextBox.Text = agentSettings.SMTPServerAddress;
            }
        }
 private void SaveDetailsToAgent()
 {
     Agent.GhostCastManagerClient gcmc = new Agent.GhostCastManagerClient();
     Status.Text = gcmc.SaveSession(GetDetailsFromForm());
 }
        private void LoadDetailsFromAgent()
        {
            Agent.GhostCastManagerClient gcmc = new Agent.GhostCastManagerClient();
            Agent.GhostCastServerOptions sessionOptions = gcmc.GetSavedSession(SavedSessionsListBox.SelectedValue);
            if (sessionOptions == null)
            {
                Status.Text = "Error: List box selection error.   Returned options is null.";
                return;
            }

            SaveNameTextBox.Text = sessionOptions.Name;
            SessionNamePrimaryTextBox.Text = sessionOptions.SessionNamePrimary;
            GhostImageFilePrimaryTextBox.Text = sessionOptions.GhostImageFilePrimary;
            if (sessionOptions.PartitionNoPrimary == 0)
            {
                DiskPartitionPrimaryRadioButtonList.SelectedValue = "Disk";
                PartitionNoPrimaryTextBox.Enabled = false;
            }
            else
            {
                DiskPartitionPrimaryRadioButtonList.SelectedValue = "Partition";
                PartitionNoPrimaryTextBox.Enabled = true;
            }
            PartitionNoPrimaryTextBox.Text = sessionOptions.PartitionNoPrimary.ToString();

            SessionNameSecondaryTextBox.Text = sessionOptions.SessionNameSecondary;
            GhostImageFileSecondaryTextBox.Text = sessionOptions.GhostImageFileSecondary;

            if (sessionOptions.PartitionNoSecondary == 0)
            {
                DiskPartitionSecondaryRadioButtonList.SelectedValue = "Disk";
                PartitionNoSecondaryTextBox.Enabled = false;
            }
            else
            {
                DiskPartitionSecondaryRadioButtonList.SelectedValue = "Partition";
                PartitionNoSecondaryTextBox.Enabled = true;
            }
            PartitionNoSecondaryTextBox.Text = sessionOptions.PartitionNoSecondary.ToString();

            AutoStartClientCountTextBox.Text = sessionOptions.AutoStartClientCount.ToString();
            AutoStartTimeTextBox.Text = sessionOptions.AutoStartTime;
            AutoStartTimeoutTextBox.Text = sessionOptions.AutoStartTimeout.ToString();
            ForceModeDropDownList.SelectedValue = Enum.GetName(typeof(Agent.GhostCastServerOptions.Mode), sessionOptions.ForceMode);
            OnCompletedDropDownList.SelectedValue = Enum.GetName(typeof(Agent.GhostCastServerOptions.CompletionAction), sessionOptions.OnCompletion);
            DualDropCheckBox.Checked = sessionOptions.DualDrop;

            SetControlStates();
            if (String.IsNullOrWhiteSpace(Status.Text))
            {
                Status.Text = String.Format("Loaded saved session {0} at {1}.", sessionOptions.Name, DateTime.Now.ToLongTimeString());
            }
        }
 private void RefreshSessions(bool includeStatus)
 {
     Stopwatch sw = new Stopwatch();
     sw.Start();
     Agent.GhostCastManagerClient gcmc = new Agent.GhostCastManagerClient();
     Agent.GhostCastSession[] sessions;
     if (String.IsNullOrWhiteSpace(StartsWithFilterTextBox.Text))
     {
         sessions = gcmc.GetGhostCastSessions();
     }
     else
     {
         sessions = gcmc.GetGhostCastSessionsFiltered(StartsWithFilterTextBox.Text);
     }
     GhostCastSessionList.DataSource = sessions;
     GhostCastSessionList.DataBind();
     sw.Stop();
     if (includeStatus)
     {
         Status.Text = String.Format("Refreshed at {0}. Refresh time: {1} sec {2} ms. Found {3} session(s).", DateTime.Now.ToLongTimeString(), sw.Elapsed.Seconds, sw.Elapsed.Milliseconds, sessions.Length);
     }
 }