public SliderForm(SliderNode EntryNode) { InitializeComponent(); DictButton = new Dictionary<SlideFormButton, Button>(); InitializeDictionaryButton(); foreach (KeyValuePair<SlideFormButton,Button> kv in DictButton) { kv.Value.Click += ButtonClick; } CurrentNode = EntryNode; LoadCurrentNode(); }
private void TEST_Load(object sender, EventArgs e) { //creo i nodi SliderNode fn = new SliderNode(); fn.panel = new FirstPanel(); SliderNode sn = new SliderNode(); sn.panel = new SecondPanel(); // assegno il giro dei nodi fn.SetNext(SlideFormButton.Right, sn); sn.SetNext(SlideFormButton.Left, fn); // creo lo slider e gli passo il primo nodo da caricare SliderForm sp = new SliderForm(fn); sp.ShowDialog(); Close(); }
private void ButtonClick(object sender, EventArgs e) { if(!DictButton.ContainsValue(sender as Button)) return; SlideFormButton btn = DictButton.First((x) => x.Value == sender as Button).Key; CanGoReturn r = CurrentNode.CanGo(btn); if(r==false) { MessageBox.Show(r.Message); return; } CurrentNode=CurrentNode.GetNext(btn); LoadCurrentNode(); }
public void SetNext(SlideFormButton btn, SliderNode panel) { Nexts.Add(btn, panel); }