Exemple #1
0
        private void LoadFamiliar_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Contours set (*.set)|*.set";

            if (ofd.ShowDialog() == true)
            {
                try
                {
                    Stream stream = File.OpenRead(ofd.FileName);

                    m_familiar = ContourInformationCollection.Load(stream);

                    m_matcher.FamiliarContours = m_familiar;
                    m_matcher.BringFamiliarContours(m_targetLen);

                    LoadedContourCollectionInfo.Text = string.Format("{0} contour(s) has been successfully loaded", m_familiar.Count);
                }
                catch (Exception exc)
                {
                    MessageBox.Show(string.Format("Error while loading contour collection: {0}", exc.Message));
                }
            }
        }
        private void LoadFamiliarButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Contour collection|*.set";

            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                using (Stream stream = File.Open(ofd.FileName, FileMode.Open))
                {
                    var loadedContours = ContourInformationCollection.Load(stream);

                    m_matcher.FamiliarContours = loadedContours;
                    m_matcher.BringFamiliarContours(m_targetContoursLenght);
                }
            }
        }
 private void AddFromCommand_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     if (m_ofd.ShowDialog() == true)
     {
         using (Stream stream = File.Open(m_ofd.FileName, FileMode.Open))
         {
             try
             {
                 ContourInformationCollection.Load(stream).ForEach(c => Contours.Add(c));
             }
             catch (Exception exc)
             {
                 MessageBox.Show(exc.Message);
             }
         }
     }
 }