Example #1
0
        private T ShowLoadJsonObjectDialog <T>()
        {
            LoadDialog.InitialDirectory = JsonFiles.JsonFilePaths[typeof(T).Name];

            LoadDialog.ShowDialog();

            if (LoadDialog.FileName != "")
            {
                return(JsonFiles.LoadFrom <T>(LoadDialog.FileName));
            }
            else
            {
                return(default(T));
            }
        }
        private void LoadButton_Click(object sender, EventArgs e)
        {
            LoadDialog   LoadDialogAdd       = new LoadDialog();
            DialogResult dialogResultAddNode = DialogResult.Cancel;

            dialogResultAddNode = LoadDialogAdd.ShowDialog();

            if (dialogResultAddNode == DialogResult.OK)
            {
                if (LoadDialogAdd.DialogResult.Equals(DialogResult.OK))
                {
                    ProtocolNode treeNode = new ProtocolNode(LoadDialogAdd.getProtocolName());
                    DataGridView DGV      = LoadDialogAdd.getDGV();
                    tlvProtocol.Nodes.Add(treeNode);
                    DataSets.dsModuleStructure3.dtSavedProtocolRow row;
                    DataSets.dsModuleStructure3.dtStepCompositeRow Compositerow;

                    foreach (DataGridViewRow DGVrow in DGV.Rows)
                    {
                        DataRowView rowView = DGVrow.DataBoundItem as DataRowView;
                        row = rowView.Row as DataSets.dsModuleStructure3.dtSavedProtocolRow;

                        foreach (DataSets.dsModuleStructure3.dtStepCompositeRow CompositeRow in dsModuleStructure.dtStepComposite)
                        {
                            if (row.fk_step_composite == CompositeRow.pk_id)
                            {
                                addNodes(CompositeRow, treeNode);
                            }
                        }
                    }
                }
            }

            //if (result == DialogResult.OK)
            //{
            //    LoadTree(tlvProtocol, dialogue.FileName);
            //}
        }
Example #3
0
 private void FileLoadButton_Click(object sender, EventArgs e) => LoadDialog.ShowDialog();