Exemple #1
0
        public SalesPrediction(ScheduleGenWindow window, int priority = 0, SalesDurationEnum duration = default(SalesDurationEnum))
        {
            InitializeComponent();
            SalesDuration = duration;
            switch (SalesDuration) // set box to correct index
            {
            case SalesDurationEnum.Last12Months:
                PastSalesComboBox.SelectedIndex = 0;
                break;

            case SalesDurationEnum.Last3Months:
                PastSalesComboBox.SelectedIndex = 1;
                break;

            case SalesDurationEnum.Last6Months:
                PastSalesComboBox.SelectedIndex = 2;
                break;

            case SalesDurationEnum.LastMonth:
                PastSalesComboBox.SelectedIndex = 3;
                break;

            case SalesDurationEnum.LastYear:
                PastSalesComboBox.SelectedIndex = 4;
                break;
            }
        }
        public static GenControl LoadControl(BinaryReader reader, ScheduleGenWindow window)
        {
            GenControl control = null;
            var        type    = reader.ReadString();

            if (type == LineControl.Type)
            {
                control = LineControl.Load(reader, window);
            }
            else if (type == RunBeforeControl.Type)
            {
                control = RunBeforeControl.Load(reader, window);
            }
            else if (type == TextureControl.Type)
            {
                control = TextureControl.Load(reader, window);
            }
            else if (type == WasteControl.Type)
            {
                control = WasteControl.Load(reader, window);
            }
            else if (type == SalesNumbersControl.Type)
            {
                control = SalesNumbersControl.Load(reader, window);
            }
            else if (type == SalesPrediction.Type)
            {
                control = SalesPrediction.Load(reader, window);
            }
            else if (type == PurgeWiPControl.Type)
            {
                control = PurgeWiPControl.Load(reader, window);
            }
            else if (type == WidthControl.Type)
            {
                control = WidthControl.Load(reader, window);
            }
            else
            {
                throw new ArgumentOutOfRangeException("Type of control not recognized");
            }

            return(control);
        }
        private bool LoadFileData(String file, ScheduleGenWindow window)
        {
            try
            {
                //using (BinaryReader reader = new BinaryReader(new FileStream(file, FileMode.Open)))
                //{
                //    ControlsList.Clear();
                //    int num = reader.ReadInt32();
                //    for (; num > 0; --num)
                //    {
                //        var genControl = GenControl.LoadControl(reader, window);
                //        ControlsList.Add(genControl);
                //    }
                //}

                return(true);
            }
            catch (Exception exception)
            {
                return(false);
            }
        }
 protected GenControl(ScheduleGenWindow parent)
 {
     ParentWindow = parent;
 }