Ejemplo n.º 1
0
        public void Open()
        {
            OpenFileDialog OpenFileDialog1 = new OpenFileDialog();

            OpenFileDialog1.Title  = "Open BRD Document";
            OpenFileDialog1.Filter = "BRD Documents (*.brd)|*.brd";
            if (OpenFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            currentFilePath = OpenFileDialog1.FileName;
            if (String.IsNullOrEmpty(currentFilePath))
            {
                return;
            }

            if (System.IO.File.Exists(currentFilePath) == false)
            {
                return;
            }

            birds = FileSerializer.Deserialize(currentFilePath);

            // Load bird at position zero
            if (birds != null)
            {
                currentBird = birds.ElementAt <BirdWatcher.BirdData>(0);
                LoadCurrentBird();
                dirtyForm = false;
            }
        }
Ejemplo n.º 2
0
 private void tsbAdd_Click(object sender, EventArgs e)
 {
     SaveCurrentBird();
     currentBird = new BirdData();
     ClearForm();
     birds.Add(currentBird);
     dirtyForm = true;
 }
Ejemplo n.º 3
0
        private void tsbNavForward_Click(object sender, EventArgs e)
        {
            SaveCurrentBird();

            if (currentPosition < birds.Count - 1)
            {
                currentPosition++;
                currentBird = birds[currentPosition];
                LoadCurrentBird();
            }
        }
Ejemplo n.º 4
0
        private void tsbNavBack_Click(object sender, EventArgs e)
        {
            SaveCurrentBird();

            if (currentPosition != 0)
            {
                currentPosition--;
                currentBird = birds[currentPosition];
                LoadCurrentBird();
            }
        }
Ejemplo n.º 5
0
        public Form1()
        {
            InitializeComponent();
            birds       = new List <BirdData>();
            currentBird = new BirdData();

            dtpDate.Value = DateTime.Now;

            currentPosition = 0;
            dirtyForm       = false;
        }
Ejemplo n.º 6
0
 private void FindBird(object sender, BirdNameUpdateEventArgs e)
 {
     for (int i = 0; i < birds.Count; i++)
     {
         if (birds[i].BirdName == e.BirdName)
         {
             currentBird = birds[i];
             LoadCurrentBird();
             currentPosition = i;
         }
     }
 }
Ejemplo n.º 7
0
        private void tsbRemoveBird_Click(object sender, EventArgs e)
        {
            birds.RemoveAt(currentPosition);

            if (currentPosition == 0)
            {
                currentPosition++;
            }
            else
            {
                currentPosition--;
            }

            currentBird = birds[currentPosition];
            LoadCurrentBird();
            dirtyForm = true;
        }