Example #1
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            // Calculate Shema and Displays
            x      = new Point(lbl_X.Location.X, lbl_X.Location.Y);
            y      = new Point(lbl_Y.Location.X, lbl_Y.Location.Y);
            z      = new Point(lbl_Z.Location.X, lbl_Z.Location.Y);
            L      = new Point(lbl_L.Location.X, lbl_L.Location.Y);
            picBox = new Point(pBox.Location.X, pBox.Location.Y);
            offset = new Point(grpSelectedCargo.Width / 2,
                               grpSelectedCargo.Height / 2);
            dX   = offset.X - x.X; dY = offset.X - y.X; dZ = offset.X - z.X; dL = offset.X - L.X;
            eX   = offset.Y - x.Y; eY = offset.Y - y.Y; eZ = offset.Y - z.Y; eL = offset.Y - L.Y;
            dPic = offset.X - picBox.X; ePic = offset.Y - picBox.Y;

            // initialize the shematic in accordance of platform
            string rslt = GetOSFriendlyName();

            if (rslt.Contains("Windows 10"))
            {
                pBox.Image = Properties.Resources.cargo_picker_w10;
            }

            // initialize the Color Picker
            cd            = new ColorDialog();
            cd.FullOpen   = true;
            pC            = Helper.GetRandomColor(); cd.Color = pC;
            txtColor.Text = ColorTranslator.ToHtml(pC);

            // initialize the data table
            dt = new DataTable();
            dt.Columns.AddRange(new DataColumn[] {
                new DataColumn("ID", typeof(string)),
                new DataColumn("Name", typeof(string)),
                new DataColumn("Long", typeof(double)),
                new DataColumn("Height", typeof(double)),
                new DataColumn("Width", typeof(double)),
                new DataColumn("Level", typeof(int)),
                new DataColumn("Weight", typeof(double)),
                new DataColumn("CBM", typeof(double)),
                new DataColumn("Color", typeof(string))
            });
            ds = new DataSet();
            ds.Tables.Add(dt);

            // Refresh Grid
            dataGridView1.DataSource            = ds.Tables[0];
            dataGridView1.Columns["ID"].Visible = false;

            // Initialize Inteli Naming Array,
            for (int i = 0; i < 1000; i++)
            {
                NameArray[i] = "Cargo " + string.Format("{0:000}", i);
            }

            // Initialize Konteyner to hold the Max Capacity.
            Konteyners.Add(new ContainerInfo("13.6 Semitrailer", 1360, 280, 240, 22000));
            cmbConSelector.DataSource    = Konteyners.ToArray();
            cmbConSelector.DisplayMember = "Name";
            // var usage = ((ContainerInfo)cmbConSelector.SelectedValue).CBM;

            // Create ToolTip Handler
            InfoTips.ToolTipIcon  = ToolTipIcon.Info;
            InfoTips.ToolTipTitle = "Info:";
            InfoTips.SetToolTip(cmbConSelector, summary);

            // Fill the Offset Selector
            cmbOffset.Items.Add(@"Top Left"); cmbOffset.Items.Add(@"Top Center"); cmbOffset.Items.Add(@"Top Right");
            cmbOffset.Items.Add(@"Middle Left"); cmbOffset.Items.Add(@"Middle Center"); cmbOffset.Items.Add(@"Middle Right");
            cmbOffset.Items.Add(@"Bottom Left"); cmbOffset.Items.Add(@"Bottom Center"); cmbOffset.Items.Add(@"Bottom Right");
            // initialize an instance of Selector Helper
            frmOffsetHelper        = new frmImageTip(cmbOffset);
            frmOffsetHelper.Image  = new Bitmap(Properties.Resources.go_none);
            cmbOffset.SelectedItem = @"Middle Left";

            // Note this flag must be the last event line! it is a Legacy System Fix for Indexy Controls
            isLoaded = true;
        }
Example #2
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            // Calculate Shema and Displays
            x = new Point(lbl_X.Location.X, lbl_X.Location.Y);
            y = new Point(lbl_Y.Location.X, lbl_Y.Location.Y);
            z = new Point(lbl_Z.Location.X, lbl_Z.Location.Y);
            L = new Point(lbl_L.Location.X, lbl_L.Location.Y);
            picBox = new Point(pBox.Location.X, pBox.Location.Y);
            offset = new Point(grpSelectedCargo.Width / 2,
                                grpSelectedCargo.Height / 2);
            dX = offset.X - x.X; dY = offset.X - y.X; dZ = offset.X - z.X; dL = offset.X - L.X;
            eX = offset.Y - x.Y; eY = offset.Y - y.Y; eZ = offset.Y - z.Y; eL = offset.Y - L.Y;
            dPic = offset.X - picBox.X; ePic = offset.Y - picBox.Y;

            // initialize the shematic in accordance of platform
            string rslt = GetOSFriendlyName();
            if (rslt.Contains("Windows 10")) { pBox.Image = Properties.Resources.cargo_picker_w10; }

            // initialize the Color Picker
            cd = new ColorDialog();
            cd.FullOpen = true;
            pC = Helper.GetRandomColor(); cd.Color = pC;
            txtColor.Text = ColorTranslator.ToHtml(pC);

            // initialize the data table
            dt = new DataTable();
            dt.Columns.AddRange(new DataColumn[]{
                   new DataColumn("ID", typeof(string)),
                   new DataColumn("Name", typeof(string)),
                   new DataColumn("Long",typeof(double)),
                   new DataColumn("Height", typeof(double)),
                   new DataColumn("Width",typeof(double)),
                   new DataColumn("Level",typeof(int)),
                   new DataColumn("Weight", typeof(double)),
                   new DataColumn("CBM",typeof(double)),
                   new DataColumn("Color", typeof(string))
            });
            ds = new DataSet();
            ds.Tables.Add(dt);

            // Refresh Grid
            dataGridView1.DataSource = ds.Tables[0];
            dataGridView1.Columns["ID"].Visible = false;

            // Initialize Inteli Naming Array,
            for (int i = 0; i < 1000; i++)
            {
                NameArray[i] = "Cargo " + string.Format("{0:000}", i);
            }

            // Initialize Konteyner to hold the Max Capacity.
            Konteyners.Add(new ContainerInfo("13.6 Semitrailer", 1360, 280, 240, 22000));
            cmbConSelector.DataSource = Konteyners.ToArray();
            cmbConSelector.DisplayMember = "Name";
            // var usage = ((ContainerInfo)cmbConSelector.SelectedValue).CBM;

            // Create ToolTip Handler
            InfoTips.ToolTipIcon = ToolTipIcon.Info;
            InfoTips.ToolTipTitle = "Info:";
            InfoTips.SetToolTip(cmbConSelector, summary);

            // Fill the Offset Selector
            cmbOffset.Items.Add(@"Top Left"); cmbOffset.Items.Add(@"Top Center"); cmbOffset.Items.Add(@"Top Right");
            cmbOffset.Items.Add(@"Middle Left"); cmbOffset.Items.Add(@"Middle Center"); cmbOffset.Items.Add(@"Middle Right");
            cmbOffset.Items.Add(@"Bottom Left"); cmbOffset.Items.Add(@"Bottom Center"); cmbOffset.Items.Add(@"Bottom Right");
            // initialize an instance of Selector Helper
            frmOffsetHelper = new frmImageTip(cmbOffset);
            frmOffsetHelper.Image = new Bitmap(Properties.Resources.go_none);
            cmbOffset.SelectedItem = @"Middle Left";

            // Note this flag must be the last event line! it is a Legacy System Fix for Indexy Controls
            isLoaded = true;
        }