Skip to content

Commit

Permalink
feat: add tagname copy to clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
gc87 committed Nov 17, 2022
1 parent 8022d8c commit c7a7744
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 24 deletions.
33 changes: 17 additions & 16 deletions MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 25 additions & 7 deletions MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ private void UpdateListView(List<Item> list)
int index = data.ClientHandle;
var items = MainListView.Items;
var item = items[index];
var subItemValue = item.SubItems[4];
var subItemQuality = item.SubItems[5];
var subItemError = item.SubItems[6];
var subItemTs = item.SubItems[7];
var subItemValue = item.SubItems[3];
var subItemQuality = item.SubItems[4];
var subItemError = item.SubItems[5];
var subItemTs = item.SubItems[6];

subItemValue.Text = Convert.ToString(data.Value);
subItemQuality.Text = data.Quality.ToString();
Expand Down Expand Up @@ -96,14 +96,14 @@ private void ResetListView(List<Item> list)
for (int i = 0; i < data.Count; i++)
{
ListViewItem lvi = new ListViewItem();
lvi.Text = data[i].ClientHandle.ToString(); // handle
lvi.SubItems.Add(data[i].Name.ToString()); // name
lvi.Text = data[i].Name.ToString(); // handle
lvi.SubItems.Add(data[i].Type.ToString()); // type
lvi.SubItems.Add(data[i].Rights.ToString()); // rights
lvi.SubItems.Add(""); // value
lvi.SubItems.Add(""); // quality
lvi.SubItems.Add(""); // error
lvi.SubItems.Add(""); // timestamp
lvi.SubItems.Add(data[i].ClientHandle.ToString()); // handle
MainListView.Items.Add(lvi);
}
MainListView.EndUpdate();
Expand Down Expand Up @@ -182,7 +182,7 @@ private void DAHostComboBox_DropDown(object sender, EventArgs e)

private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
var result = MessageBox.Show("Do you want to exit the program?", "warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
var result = MessageBox.Show("Do you want to exit the program?", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
if (DialogResult.Cancel == result)
{
e.Cancel = true;
Expand All @@ -207,5 +207,23 @@ private void RunButton_Click(object sender, EventArgs e)
UAUserTextBox.Enabled = false;
UAPasswordTextBox.Enabled = false;
}

private void MainListView_MouseDoubleClick(object sender, MouseEventArgs e)
{
ListView listView = (ListView)sender;
ListViewItem row = listView.GetItemAt(e.X, e.Y);
ListViewItem.ListViewSubItem col = row.GetSubItemAt(e.X, e.Y);
string strText = col.Text;
try
{
Clipboard.SetDataObject(strText);
string info = $"The content [{strText}] has been copied to the clipboard";
MessageBox.Show(info, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
2 changes: 1 addition & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static void Main()
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.WriteTo.Console()
.WriteTo.File("neuopc.log", rollingInterval: RollingInterval.Day)
.WriteTo.File("log/neuopc.log", rollingInterval: RollingInterval.Day)
.CreateLogger();

Register.Setup();
Expand Down

0 comments on commit c7a7744

Please sign in to comment.