Пример #1
0
        private void OnDelete(object sender, EventArgs e)
        {
            ServerCommandSchedule serverCommandSchedule = sender as ServerCommandSchedule;

            if (serverCommandSchedule != null)
            {
                this.schedulesByTime[serverCommandSchedule.Key].Remove(serverCommandSchedule.ScheduleName);
                int height = this.panelSchdule.Size.Height;
                this.panelSchdule.Controls.Remove(serverCommandSchedule);
                int num = 0;
                foreach (object obj in this.panelSchdule.Controls)
                {
                    ServerCommandSchedule serverCommandSchedule2 = (ServerCommandSchedule)obj;
                    serverCommandSchedule2.Location = new Point(2, num++ *40);
                }
                int          height2 = this.panelSchdule.Size.Height;
                AnchorStyles anchor  = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                AnchorStyles anchor2 = this.panelMid.Anchor;
                AnchorStyles anchor3 = this.panelBottom.Anchor;
                this.panelMid.Anchor    = anchor;
                this.panelBottom.Anchor = anchor;
                base.Size               = new Size(base.Size.Width, base.Size.Height + height2 - height);
                this.panelMid.Anchor    = anchor2;
                this.panelBottom.Anchor = anchor3;
                this.ScheduleModified   = true;
                this.allScheduleCount--;
            }
        }
Пример #2
0
        private void AddSchedule(string key, DateTime datetime, string name, string command)
        {
            int    num  = 1;
            string text = name;

            while (this.schedulesByTime[key].ContainsKey(text) || this.schedulesOther[key].ContainsKey(text))
            {
                text = string.Format("{0} {1}", name, num++);
            }
            datetime = datetime.AddSeconds((double)(-(double)datetime.Second));
            RCProcessScheduler rcprocessScheduler = new RCProcessScheduler(text, RCProcessScheduler.EScheduleType.Once, datetime, RCProcessScheduler.EExeType.StdInput, command, true);
            int height = this.panelSchdule.Size.Height;
            ServerCommandSchedule serverCommandSchedule = new ServerCommandSchedule(key, rcprocessScheduler);

            serverCommandSchedule.OnDelete += this.OnDelete;
            serverCommandSchedule.Size      = new Size(this.panelSchdule.Width - 2, 40);
            serverCommandSchedule.Location  = new Point(2, this.allScheduleCount * 40);
            this.panelSchdule.Controls.Add(serverCommandSchedule);
            serverCommandSchedule.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
            int          height2 = this.panelSchdule.Size.Height;
            AnchorStyles anchor  = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            AnchorStyles anchor2 = this.panelMid.Anchor;
            AnchorStyles anchor3 = this.panelBottom.Anchor;

            this.panelMid.Anchor    = anchor;
            this.panelBottom.Anchor = anchor;
            base.Size               = new Size(base.Size.Width, base.Size.Height + height2 - height);
            this.panelMid.Anchor    = anchor2;
            this.panelBottom.Anchor = anchor3;
            this.schedulesByTime[key].Add(text, rcprocessScheduler);
            this.allScheduleCount++;
        }