private void findButton_Click(object sender, EventArgs e)
        {
            if (this.ValidateChildren())
            {
                SlotFinder slotFinder     = new SlotFinder();
                var        findSlotParams = new FindSlotParams
                {
                    Email    = emailAddressTextBox.Text,
                    Password = passwordTextBox.Text,
                    Dates    = selectedDatesListBox.Items.Cast <DateTime>().ToList()
                };

                var result     = slotFinder.FindSlot(findSlotParams);
                var resultText = result.Succeeded
                    ? $"Slot was successfully booked for { result.DateBooked.Value.ToString("d") }"
                    : "Slot was not booked";
                resultLabel.Text = resultText;
            }
        }
 private static bool IsNamespace(ClassDefinition cd)
 {
     SlotFinder sf = new SlotFinder();
     cd.Walk(sf);
     if (sf.HasSubTypes && !sf.HasFunctions && !sf.FoundSlots && cd.Bases.Count == 0) {
         return true;
     }
     return false;
 }
            /// <summary>
            /// Starts a class definition.  This will create the new type, 
            /// the static constructor & emit the initialization into it,
            /// and then push the type onto the stack.  
            /// 
            /// Later the walker will emit all of the statements in the class 
            /// definition into the static constructor.
            /// </summary>
            public override bool Walk(ClassDefinition cd)
            {
                // class definition - could either by a real type, or
                // a namespace.  If it only contains class defintions
                // and no slots then it's a namespace.
                if (IsNamespace(cd)) {
                    namespaces.Add(cd.Name.GetString());
                    return true;
                }

                // - emit all class initialization inside of
                // static ctor.

                SlotFinder sf = new SlotFinder();
                cd.Walk(sf);

                TypeGen baseTg;
                List<Type> baseTypes = GetBaseType(cd, out baseTg);
                if (baseTypes == null) {
                    // we don't know the base types, just emit it the old way...
                    namespaces.Add(cd.Name.GetString());
                    return true;
                }

                TypeGen newType = DefineNewType(cd, baseTypes);
                CodeGen getCompiledType = AddIDynamicObject(newType, newType.AddField(typeof(IDictionary<SymbolId, object>), "__dict__"));

                CodeGen ctorBuilder = AddDefaultCtor(newType, sf.Slots);
                CodeGen classInit = DefineClassInit(cd, newType);

                PushNewType(newType, classInit, ctorBuilder, baseTypes);
                stack.Peek().GetCompiledType = getCompiledType;

                // continue the walk on just the body (returning
                // true would have us walk the bases & the body).
                cd.Body.Walk(this);
                return false;
            }