Esempio n. 1
0
        public void ShowAllClick(object sender, EventArgs e)
        {
            // variables
            ICommand show    = mCommands["show"];
            int      current = 0;

            // show all
            foreach (TimeZoneInfo item in Window.TimeZones.Items)
            {
                if (current == item.BaseUtcOffset.Hours)
                {
                    continue;
                }

                ShowEventArgs args = new ShowEventArgs();

                args.Type     = (string)Window.Type.SelectedItem;
                args.Timezone = item;
                args.X        = -1;          // position is system defined
                args.Y        = -1;          // position is system defined
                current       = item.BaseUtcOffset.Hours;

                show.Execute(args);
            }
        }
Esempio n. 2
0
        public virtual void Execute(EventArgs a)
        {
            // variables
            Form          form = null;
            ShowEventArgs args = (ShowEventArgs)a;

            // execution logic
            if (args.Type == "Digital")
            {
                // new window
                form = new DigitalForm(args.Timezone, args.X, args.Y);
            }
            else if (args.Type == "Analog")
            {
                // new window
                form = new AnalogForm(args.Timezone, args.X, args.Y);
            }

            // set closing event
            form.FormClosing += new FormClosingEventHandler((object sender, FormClosingEventArgs arg) => {
                Clock.Detach((IObserver)sender);
            });

            // attach window
            Clock.Attach((IObserver)form);

            // run window
            form.Show();
        }
Esempio n. 3
0
        public void ShowClick(object sender, EventArgs e)
        {
            // variables
            ShowEventArgs args = new ShowEventArgs();

            // set arguments
            args.Type     = (string)Window.Type.SelectedItem;
            args.Timezone = (TimeZoneInfo)Window.TimeZones.SelectedItem;
            args.X        = (int)Window.PositionX.Value;
            args.Y        = (int)Window.PositionY.Value;

            // call command
            mCommands["show"].Execute(args);
        }