forked from Ylianst/MeshCentralAssistant
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
2,356 additions
and
94 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Data; | ||
using System.Drawing; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace MeshAssistant | ||
{ | ||
public partial class GuestSharingForm : Form | ||
{ | ||
MainForm parent; | ||
|
||
public GuestSharingForm(MainForm parent) | ||
{ | ||
this.parent = parent; | ||
InitializeComponent(); | ||
UpdateInfo(); | ||
} | ||
|
||
private void closeButton_Click(object sender, EventArgs e) | ||
{ | ||
Close(); | ||
} | ||
|
||
private void copyLinkButton_Click(object sender, EventArgs e) | ||
{ | ||
if (linkTextBox.Text != "") { Clipboard.SetText(linkTextBox.Text); } | ||
} | ||
|
||
public void UpdateInfo() | ||
{ | ||
// Update state from the mesh agent | ||
if ((parent.mcagent != null) && (parent.mcagent.selfSharingUrl != null)) | ||
{ | ||
linkTextBox.Text = parent.mcagent.selfSharingUrl; | ||
desktopCheckBox.Checked = ((parent.mcagent.selfSharingFlags & 1) != 0); | ||
viewOnlyCheckBox.Checked = parent.mcagent.selfSharingViewOnly; | ||
terminalCheckBox.Checked = ((parent.mcagent.selfSharingFlags & 2) != 0); | ||
filesCheckBox.Checked = ((parent.mcagent.selfSharingFlags & 4) != 0); | ||
} | ||
else | ||
{ | ||
linkTextBox.Text = ""; | ||
} | ||
|
||
// Update the UI state | ||
copyLinkButton.Enabled = (linkTextBox.Text != ""); | ||
cancelSharingButton.Enabled = (linkTextBox.Text != ""); | ||
if (linkTextBox.Text == "") | ||
{ | ||
desktopCheckBox.Enabled = true; | ||
viewOnlyCheckBox.Enabled = desktopCheckBox.Checked; | ||
terminalCheckBox.Enabled = true; | ||
filesCheckBox.Enabled = true; | ||
createLinkButton.Enabled = (desktopCheckBox.Checked || terminalCheckBox.Checked || filesCheckBox.Checked); | ||
} | ||
else | ||
{ | ||
desktopCheckBox.Enabled = false; | ||
viewOnlyCheckBox.Enabled = false; | ||
terminalCheckBox.Enabled = false; | ||
filesCheckBox.Enabled = false; | ||
createLinkButton.Enabled = false; | ||
} | ||
} | ||
|
||
private void desktopCheckBox_CheckedChanged(object sender, EventArgs e) | ||
{ | ||
UpdateInfo(); | ||
} | ||
|
||
private void GuestSharingForm_FormClosing(object sender, FormClosingEventArgs e) | ||
{ | ||
parent.guestSharingForm = null; | ||
} | ||
|
||
private void createLinkButton_Click(object sender, EventArgs e) | ||
{ | ||
int flags = 0; | ||
if (desktopCheckBox.Checked) { flags += 1; } | ||
if (terminalCheckBox.Checked) { flags += 2; } | ||
if (filesCheckBox.Checked) { flags += 4; } | ||
if (parent.mcagent != null) { parent.mcagent.sendRequestGuestSharing(flags, viewOnlyCheckBox.Checked); } | ||
} | ||
|
||
private void cancelSharingButton_Click(object sender, EventArgs e) | ||
{ | ||
if (parent.mcagent != null) { parent.mcagent.sendRequestGuestSharing(0, false); } | ||
} | ||
} | ||
} |
Oops, something went wrong.