Esempio n. 1
0
        private void Add_Click(object sender, EventArgs e)
        {
            PluginRequestDataStruct NewPluginDataStruct = new PluginRequestDataStruct();

            NewPluginDataStruct.FileName     = FileToUse;
            NewPluginDataStruct.SerialNumber = PluginID.Text;
            PluginCommands PluginCommandsForm = new PluginCommands(NewPluginDataStruct);

            PluginCommandsForm.ShowDialog();
            NewPluginDataStruct = PluginCommandsForm.PluginRequestData;
            if (NewPluginDataStruct.Save)
            {
                PluginRequestData[PluginRequestDataCounter] = NewPluginDataStruct;
                PluginRequestDataCounter++;
                SortColumns(ColumnSorted);
                Save.Enabled = true;
                Changed      = true;
            }
        }
Esempio n. 2
0
        private void MainListView_DoubleClick(object sender, EventArgs e)
        {
            PluginRequestDataStruct NewPluginDataStruct = new PluginRequestDataStruct();
            ListViewItem            item = MainListView.SelectedItems[0];

            NewPluginDataStruct              = PluginRequestData[(int)item.Tag];
            NewPluginDataStruct.FileName     = FileToUse;
            NewPluginDataStruct.SerialNumber = PluginID.Text;
            NewPluginDataStruct.New          = false;

            PluginCommands PluginCommandsForm = new PluginCommands(NewPluginDataStruct);

            PluginCommandsForm.ShowDialog();
            NewPluginDataStruct = PluginCommandsForm.PluginRequestData;
            if (NewPluginDataStruct.Save)
            {
                PluginRequestData[(int)item.Tag] = NewPluginDataStruct;
                SortColumns(ColumnSorted);
                Save.Enabled = true;
                Changed      = true;
            }
        }
Esempio n. 3
0
        private void PluginCommansGrid_Shown(object sender, EventArgs e)
        {
            PluginRequestData = new PluginRequestDataStruct[99];

            openFileDialog1.InitialDirectory = Directory.GetCurrentDirectory();

            XmlDocument doc = new XmlDocument();

            try
            {
                doc.Load(@"PluginCommands");

                foreach (XmlNode node in doc.DocumentElement.ChildNodes)
                {
                    foreach (XmlNode Cnode in node)
                    {
                        if (node.Name == "LastPath")
                        {
                            openFileDialog1.InitialDirectory = node.InnerText;
                        }
                    }
                }
            }
            catch
            {
            }



            DialogResult result = openFileDialog1.ShowDialog();

            if (result != DialogResult.OK)
            {
                Close();
                return;
            }
            FileToUse = openFileDialog1.FileName;
            if (!File.Exists(FileToUse))
            {
                PluginRequestDataStruct NewPluginDataStruct = new PluginRequestDataStruct();
                NewPluginDataStruct.FileName = FileToUse;
                NewPluginDataStruct.New      = true;
                PluginCommands PluginCommandsForm = new PluginCommands(NewPluginDataStruct);
                PluginCommandsForm.ShowDialog();
            }
            XmlDocument Data     = new XmlDocument();
            XmlNode     DataNode = Data.CreateXmlDeclaration("1.0", "UTF-8", null);

            Data.AppendChild(DataNode);

            XmlNode DataNodeRoot;
            XmlNode DataNodeNode;

            DataNodeRoot = Data.CreateElement("PluginCommandsDocumentation");
            Data.AppendChild(DataNodeRoot);

            DataNodeNode = Data.CreateElement("LastPath");
            DataNodeNode.AppendChild(Data.CreateTextNode(Path.GetDirectoryName(FileToUse)));
            DataNodeRoot.AppendChild(DataNodeNode);
            Data.Save("PluginCommands");


            MainListView.Columns.Add("Command Number", -2, HorizontalAlignment.Left);
            MainListView.Columns.Add("Command Name", -2, HorizontalAlignment.Left);
            MainListView.Columns.Add("Comments", -2, HorizontalAlignment.Left);

            LoadandProcessDocumentation();
            SortColumns(ColumnSorted);
            Save.Enabled = false;
        }