Exemplo n.º 1
0
 private void lbDetachments_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (foc != null)
     {
         if (lbDetachments.SelectedItem != null)
         {
             selectedDetachment = (ModelClasses.Detachment)lbDetachments.SelectedItem;
             RefreshDetachment();
         }
     }
 }
Exemplo n.º 2
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            if (foc != null && selectedDetachment != null)
            {
                DialogResult userChoice = MessageBox.Show(this, "Willst Du das gewählte Detachment \'" + selectedDetachment.Name + "\' wirklich löschen?", "Achtung - Wirklich löschen?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (userChoice == DialogResult.Yes)
                {
                    foc.Detachments.Remove(selectedDetachment);
                    selectedDetachment = null;
                    RefreshView();
                    RefreshFocInformation();
                    RefreshDetachment();
                }
            }
        }
Exemplo n.º 3
0
        public void OpenFocFromDisk()
        {
            if (ProgramRunningMode != RunMode.empty && (edited || !saved))
            {
                DialogResult usersChoice = MessageBox.Show(this, "Es liegen ungesicherte Änderungen an der aktuellen Armee-Liste vor. Sollen die vor dem öffnen gespeichert werden?", "Vorsicht - ungesicherte Änderungen", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (usersChoice == DialogResult.Yes)
                {
                    Save();
                }
            }

            openFocFile.DefaultExt = "xml";
            openFocFile.FileName   = "";
            openFocFile.Filter     = "ArmyList XML (*.axml)|*.axml";

            DialogResult res = openFocFile.ShowDialog();

            if (res == DialogResult.OK)
            {
                if (openFocFile.FileName != null)
                {
                    foc = new ModelClasses.ForceOrgChart();
                    selectedDetachment = null;
                    ClearView();

                    armylistFilename = openFocFile.FileName;
                    try
                    {
                        ReadFoc(armylistFilename);
                        saved              = true;
                        edited             = false;
                        ProgramRunningMode = RunMode.opened;
                        RefreshView();
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(this, "Kann die Datei nicht einlesen: " + e.Message, "Auweia", MessageBoxButtons.OK, MessageBoxIcon.Error);

                        saved              = false;
                        edited             = true;
                        ProgramRunningMode = RunMode.empty;
                    }
                }
            }

            RefreshView();
        }
Exemplo n.º 4
0
 public Detachment(Detachment copyDetachment)
 {
     if (copyDetachment != null)
     {
         Name                    = copyDetachment.Name;
         CommandPoints           = copyDetachment.CommandPoints;
         Faction                 = copyDetachment.Faction;
         DoesContainTransports   = copyDetachment.DoesContainTransports;
         AllowsSingleFactionOnly = copyDetachment.AllowsSingleFactionOnly;
         Slots                   = new List <Slot>();
         foreach (Slot slt in copyDetachment.Slots)
         {
             Slot newSlot = new Slot(slt);
             Slots.Add(newSlot);
         }
     }
 }