2022-04-07 06:37:54 +00:00
|
|
|
|
using Aml.Editor.Plugin.Properties;
|
|
|
|
|
using System;
|
2022-03-11 16:13:30 +00:00
|
|
|
|
using System.Drawing;
|
2022-04-07 06:37:54 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Windows.Forms;
|
2022-03-11 16:13:30 +00:00
|
|
|
|
|
|
|
|
|
namespace Aml.Editor.Plugin
|
|
|
|
|
{
|
|
|
|
|
class AnimationClass
|
|
|
|
|
{
|
|
|
|
|
public Panel PanelNumber { get; set; }
|
|
|
|
|
public Button ButtonNumber { get; set; }
|
|
|
|
|
public WebBrowser Webbrowser { get; set; }
|
|
|
|
|
public TextBox TextboxName { get; set; }
|
|
|
|
|
public PictureBox PictureboxNumber { get; set; }
|
|
|
|
|
public Button DisplayBtn { get; set; }
|
|
|
|
|
public DataGridView dataGridView { get; set; }
|
|
|
|
|
public string words { get; set; }
|
2022-04-07 06:37:54 +00:00
|
|
|
|
// public TreeNode Node { get; set; }
|
2022-03-11 16:13:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AnimationClass()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Method for window size maximum and minimum
|
2022-04-07 06:37:54 +00:00
|
|
|
|
public void WindowSizeChanger(Panel panelNumber, Button buttonNumber)
|
2022-03-11 16:13:30 +00:00
|
|
|
|
{
|
|
|
|
|
PanelNumber = panelNumber;
|
|
|
|
|
ButtonNumber = buttonNumber;
|
|
|
|
|
if (panelNumber.Size == panelNumber.MaximumSize)
|
|
|
|
|
{
|
|
|
|
|
panelNumber.Size = panelNumber.MinimumSize;
|
|
|
|
|
buttonNumber.Image = Resources.icons8_expand_arrow_24;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
panelNumber.Size = panelNumber.MaximumSize;
|
|
|
|
|
buttonNumber.Image = Resources.icons8_collapse_arrow_24;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void WindowSizeChanger(Panel panelNumber)
|
|
|
|
|
{
|
|
|
|
|
PanelNumber = panelNumber;
|
2022-04-07 06:37:54 +00:00
|
|
|
|
// Node = node;
|
2022-03-11 16:13:30 +00:00
|
|
|
|
if (panelNumber.Size == panelNumber.MaximumSize)
|
|
|
|
|
{
|
|
|
|
|
panelNumber.Size = panelNumber.MinimumSize;
|
|
|
|
|
//Node.Image = Resources.icons8_expand_arrow_24;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
panelNumber.Size = panelNumber.MaximumSize;
|
|
|
|
|
//Node.Image = Resources.icons8_collapse_arrow_24;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string OpenFileDialog(TextBox textboxName)
|
|
|
|
|
{
|
|
|
|
|
TextboxName = textboxName;
|
2022-04-07 06:37:54 +00:00
|
|
|
|
|
2022-03-11 16:13:30 +00:00
|
|
|
|
OpenFileDialog open = new OpenFileDialog();
|
|
|
|
|
open.Filter = "Document Files(*.pdf; *.doc;*.jpg; *.jpeg; *.gif; *.bmp; *.png;)|*.pdf; *.doc;*.jpg; *.jpeg; *.gif; *.bmp; *.png;";
|
|
|
|
|
if (open.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
textboxName.Text = open.FileName;
|
2022-04-07 06:37:54 +00:00
|
|
|
|
|
2022-03-11 16:13:30 +00:00
|
|
|
|
}
|
|
|
|
|
string nameOfFile = Path.GetFileName(open.FileName);
|
|
|
|
|
return nameOfFile;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OpenFileDialog(TextBox textboxName, Button pdfDisplayBtn)
|
|
|
|
|
{
|
|
|
|
|
TextboxName = textboxName;
|
|
|
|
|
DisplayBtn = pdfDisplayBtn;
|
|
|
|
|
WebBrowser webbrowser = new WebBrowser();
|
|
|
|
|
OpenFileDialog open = new OpenFileDialog();
|
|
|
|
|
open.Filter = "Files(*.pdf; *.doc;)|*.pdf; *.doc;";
|
|
|
|
|
if (open.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
textboxName.Text = open.FileName;
|
|
|
|
|
pdfDisplayBtn.Visible = true;
|
|
|
|
|
pdfDisplayBtn.Text = Path.GetFileName(open.FileName);
|
2022-04-07 06:37:54 +00:00
|
|
|
|
|
2022-03-11 16:13:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-04-07 06:37:54 +00:00
|
|
|
|
// method for opening IEC-CDD urls
|
|
|
|
|
public void ManualOpener(string btnText)
|
2022-03-11 16:13:30 +00:00
|
|
|
|
{
|
|
|
|
|
string mainUrl = "https://cdd.iec.ch/CDD/IEC62683/iec62683.nsf/PropertiesAllVersions/0112-2---62683%23";
|
|
|
|
|
string lastUrl = "?OpenDocument";
|
|
|
|
|
string midUrl = btnText.Substring(15);
|
2022-04-07 06:37:54 +00:00
|
|
|
|
string finalUrl = mainUrl + midUrl + lastUrl;
|
|
|
|
|
|
2022-03-11 16:13:30 +00:00
|
|
|
|
System.Diagnostics.Process.Start(finalUrl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Open Dialog Box related method that takes parmeters of textbox name and the picture box number.
|
2022-04-07 06:37:54 +00:00
|
|
|
|
public void OpenFileDialog(TextBox textboxName, PictureBox pictureBoxNumber)
|
2022-03-11 16:13:30 +00:00
|
|
|
|
{
|
|
|
|
|
TextboxName = textboxName;
|
|
|
|
|
PictureboxNumber = pictureBoxNumber;
|
|
|
|
|
OpenFileDialog open = new OpenFileDialog();
|
|
|
|
|
open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp; *.png;)|*.jpg; *.jpeg; *.gif; *.bmp; *.png;";
|
|
|
|
|
if (open.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
textboxName.Text = open.FileName;
|
|
|
|
|
pictureBoxNumber.Image = new Bitmap(open.FileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OpenFileDialog(TextBox textboxName, PictureBox pictureBoxNumber, Button displayButton)
|
|
|
|
|
{
|
|
|
|
|
TextboxName = textboxName;
|
|
|
|
|
PictureboxNumber = pictureBoxNumber;
|
|
|
|
|
DisplayBtn = displayButton;
|
|
|
|
|
OpenFileDialog open = new OpenFileDialog();
|
|
|
|
|
open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp; *.png;)|*.jpg; *.jpeg; *.gif; *.bmp; *.png;";
|
|
|
|
|
if (open.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
textboxName.Text = open.FileName;
|
|
|
|
|
pictureBoxNumber.Image = new Bitmap(open.FileName);
|
|
|
|
|
displayButton.Visible = true;
|
|
|
|
|
displayButton.Text = Path.GetFileName(open.FileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// this method dispaly all hidden buttons with the Refsemantic Id in them.
|
2022-04-07 06:37:54 +00:00
|
|
|
|
public void DispalySemanticBtn(Button refSemanticBtn, DataGridView dataGrids, string word)
|
2022-03-11 16:13:30 +00:00
|
|
|
|
{
|
|
|
|
|
words = word;
|
|
|
|
|
DisplayBtn = refSemanticBtn;
|
|
|
|
|
dataGridView = dataGrids;
|
|
|
|
|
|
|
|
|
|
DisplayBtn.Visible = true;
|
|
|
|
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
foreach (DataGridViewRow attribute in dataGridView.Rows)
|
|
|
|
|
{
|
|
|
|
|
if (attribute.Cells[1].Value.ToString().Equals(words))
|
|
|
|
|
{
|
|
|
|
|
DisplayBtn.Text = attribute.Cells[0].Value.ToString();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception exc)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(exc.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|