コード例 #1
0
        private void addAnswerPctrbx_Click(object sender, EventArgs e)
        {
            addQuestionUC uc = new addQuestionUC();

            uc.Disposed += refreshQuestionsID;
            MainPanel.Controls.Add(uc);
        }
コード例 #2
0
 private void MainPanel_DragDrop(object sender, DragEventArgs e)
 {
     if (e.Data != null)
     {
         string[] paths = (string[])e.Data.GetData(DataFormats.FileDrop, true);
         if (Path.GetExtension(paths[0]) != ".xml")
         {
             MetroFramework.MetroMessageBox.Show(this, "Wrong Extension", "Error To Open File");
             return;
         }
         XmlSerializer        serializer = new XmlSerializer(typeof(List <QuestionBlock>));
         List <QuestionBlock> tmp;
         using (FileStream fileStream = new FileStream(paths[0], FileMode.Open))
         {
             tmp = (List <QuestionBlock>)serializer.Deserialize(fileStream);
         }
         MainPanel.Controls.Clear();
         addQuestionUC.staticID = 0;
         foreach (var item in tmp)
         {
             addQuestionUC uc = new addQuestionUC(item);
             uc.Disposed += refreshQuestionsID;
             MainPanel.Controls.Add(uc);
         }
     }
 }
コード例 #3
0
        public createQuestionForm()
        {
            InitializeComponent();
            addQuestionUC uc = new addQuestionUC();

            uc.Disposed += refreshQuestionsID;
            MainPanel.Controls.Add(uc);
        }