Пример #1
0
 private static void Main(string[] args)
 {
     if (args.Length == 1) {
         ProgramManager pm = new ProgramManager(args[0]);
         Console.WriteLine("Model loaded successfully");
         pm.Execute();
     }
     else {
         Console.WriteLine("Error in parameters");
     }
     Console.WriteLine("Press any key to contiue...");
     Console.ReadKey();
 }
Пример #2
0
 public abstract void Execute(ProgramManager pm);
Пример #3
0
 protected abstract RWSection GetNewSection(ProgramManager pm);
Пример #4
0
 public override void Execute(ProgramManager pm)
 {
     Console.WriteLine("Unknown command");
 }
Пример #5
0
 public override void Execute(ProgramManager pm)
 {
     foreach (RWSection section in pm.Current.Childs) {
         Console.WriteLine(section.Header);
     }
 }
Пример #6
0
 public override void Execute(ProgramManager pm)
 {
     pm.Current = GetNewSection(pm);
 }
Пример #7
0
 protected override RWSection GetNewSection(ProgramManager pm)
 {
     return pm.Root;
 }
Пример #8
0
 protected override RWSection GetNewSection(ProgramManager pm)
 {
     if (pm.Current != pm.Root) {
         return pm.Current.Parent;
     }
     else
         throw new Exception("You are already in the root section");
 }
Пример #9
0
 protected override RWSection GetNewSection(ProgramManager pm)
 {
     RWSection[] childSections = (from c in pm.Current.Childs
                                  where (int)c.Header.Id == this.NewSectionType
                                  select c).ToArray() as RWSection[];
     if (this.NewSectionNumber < childSections.Length) {
         return childSections[NewSectionNumber];
     }
     else {
         throw new Exception(String.Format("There is no child section {O}[{1}]", this.NewSectionType, this.NewSectionNumber));
     }
 }
Пример #10
0
 public override void Execute(ProgramManager pm)
 {
     Console.WriteLine("Goodbye!");
 }
Пример #11
0
 public override void Execute(ProgramManager pm)
 {
     // Пустой метод.
 }