コード例 #1
0
        public CollisionShape(BinaryReader br)
        {
            ObjSize  = br.ReadUInt32();
            Name     = br.ReadCString(Constants.SizeName);
            ObjectId = br.ReadInt32();
            ParentId = br.ReadInt32();
            Flags    = (GENOBJECTFLAGS)br.ReadUInt32();

            LoadTracks(br);

            Type = (GEOM_SHAPE)br.ReadUInt32();
            switch (Type)
            {
            case GEOM_SHAPE.SHAPE_BOX:
                Box = new CBox(br);
                break;

            case GEOM_SHAPE.SHAPE_CYLINDER:
                Cylinder = new CCylinder(br);
                break;

            case GEOM_SHAPE.SHAPE_PLANE:
                Plane = new CPlane(br);
                break;

            case GEOM_SHAPE.SHAPE_SPHERE:
                Sphere = new CSphere(br);
                break;
            }
        }
コード例 #2
0
ファイル: ServerPage.xaml.cs プロジェクト: samljer/Nitrox
        public ServerPage(LauncherLogic logic)
        {
            InitializeComponent();

            // Change style depending on windows version. Win 10 uses other definition of comboboxes then win 7 so win 10 has its own style
            if (Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor > 1)
            {
                CBox.Style = (Style)Resources["ComboBoxStyle"];
                CBox.ApplyTemplate();
            }
            this.logic = logic;
        }
コード例 #3
0
        private void btnOk__Click(object sender, EventArgs e)
        {
            if (ValidateData())
            {
                CBox boundbox = this.hdapp.ActiveDocument.BoundingBox;
                if (boundbox != null)
                {
                    //Delete the existing
                    //ViewerUtils.DeleteEntitiesByLabel(this.hdapp.ActiveDocument, HeadsUtils.Constants.LABEL_DETAILS, false);

                    HeadsUtils.Detail Det = new Detail();
                    double            z   = 0.0;
                    Det.XMin       = boundbox.TopLeft.X;
                    Det.YMin       = boundbox.TopLeft.Y;
                    z              = boundbox.TopLeft.Z;
                    Det.ModelName  = this.SelectedModelName;
                    Det.StringName = this.SelectedStringLabel;
                    Det.TextSize   = this.tbTextSize_.Value;
                    Det.Rotation   = 0;
                    //For Halign Details1 to Details2
                    //For Valign Details2 to Details1
                    //string strFileName = (this.IsValign == false) ? "DETAILS1.TMP" : "DETAILS2.TMP";
                    string       PathName = Path.Combine(this.hdapp.AppDataPath, "DETAILS1.TMP");
                    BinaryWriter bw       = new BinaryWriter(new FileStream(PathName, FileMode.Create), Encoding.Default);
                    Det.ToStream(bw);
                    bw.Close();

                    string strDetailsOutFile = Path.Combine(this.hdapp.AppDataPath, "DETAILS2.TMP");
                    ViewerUtils.DeleteFileIfExists(strDetailsOutFile);

                    if (this.IsValign == false)
                    {
                        CDetailsHalignUtil util = new CDetailsHalignUtil();
                        util.Funcmain(this.hdapp.AppDataPath);
                    }
                    else
                    {
                        CDetailsValignUtil util = new CDetailsValignUtil();
                        util.Funcmain(this.hdapp.AppDataPath, this.hdapp.ActiveDocument.ConfigParam);
                    }

                    if (File.Exists(strDetailsOutFile))
                    {
                        DrawingUtil.DrawDrg(this.hdapp, strDetailsOutFile, HeadsUtils.Constants.LABEL_DETAILS, true);
                        this.hdapp.ActiveDocument.RefreshDocument();
                    }
                }

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
コード例 #4
0
        private void UpdateComboBox()
        {
            if (!((process == Process.Modify) && (dataType == DataType.User) && !user.GetPermit(DataType.User)))
            {
                CBox.ResetText();
                CBox.Items.Clear();
                switch (dataType)
                {
                case DataType.User:
                    List <string> usersNames = dataManager.GetUserNames();
                    foreach (string name in usersNames)
                    {
                        CBox.Items.Add(name);
                    }
                    break;

                case DataType.Storage:
                    List <string> storagesNames = dataManager.GetStorageName();
                    foreach (string name in storagesNames)
                    {
                        CBox.Items.Add(name);
                    }
                    break;

                case DataType.Item:
                    List <string> itemsCodes = dataManager.GetItemCodes();
                    foreach (string code in itemsCodes)
                    {
                        CBox.Items.Add(code);
                    }
                    break;

                case DataType.Inventory:
                    List <string> itemCodes = dataManager.GetItemCodes();
                    foreach (string code in itemCodes)
                    {
                        CBox.Items.Add(code);
                    }
                    break;

                case DataType.Search:
                    List <string> itemCodes1 = dataManager.GetItemCodes();
                    foreach (string code in itemCodes1)
                    {
                        CBox.Items.Add(code);
                    }
                    break;
                }
            }
            Update();
        }
コード例 #5
0
        private void EsignBtn_Click(object sender, EventArgs e)
        {
            try
            {
                clac();

                CBox.Clear();
            }
            catch (FormatException fx)
            {
                error.ErrorListBox.Items.Add(fx);
                error.Show();
            }
        }
コード例 #6
0
        private void btnOk__Click(object sender, EventArgs e)
        {
            if (this.ValidateData())
            {
                //string PathName;
                Grid Grd = new Grid();
                //CCfgtype cfg;

                CBox box = this.headsApp.ActiveDocument.BoundingBox;
                if (box != null)
                {
                    //Delete Existing
                    ViewerUtils.DeleteEntitiesByLabel(this.headsApp.ActiveDocument, HeadsUtils.Constants.LABEL_GRID, false);

                    double[] xy = new double[] { box.BottomRight.X, box.BottomRight.Y, box.TopLeft.X, box.TopLeft.Y };

                    Grd.ModelName  = "$$$$$$$$";
                    Grd.StringName = "****";
                    Grd.MinX       = xy[0];
                    Grd.MinY       = xy[1];
                    Grd.MaxX       = xy[2];
                    Grd.MaxY       = xy[3];

                    Grd.XInterval = this.tbXInterval_.Value;
                    Grd.YInterval = this.tbYInterval_.Value;
                    Grd.Rotation  = 0;
                    Grd.TextSize  = this.tbTextSize_.Value;

                    string FileName = Path.Combine(this.headsApp.AppDataPath, "GRID1.TMP");

                    BinaryWriter bw = new BinaryWriter(new FileStream(FileName, FileMode.Create), Encoding.Default);
                    Grd.ToStream(bw);
                    bw.Close();

                    FileName = Path.Combine(this.headsApp.AppDataPath, "GRID2.TMP");

                    ViewerUtils.DeleteFileIfExists(FileName);

                    CCoordinatesUtil util = new CCoordinatesUtil();
                    util.Funcmain(this.headsApp.AppDataPath);

                    DrawingUtil.DrawChainage(this.headsApp, FileName, HeadsUtils.Constants.LABEL_GRID, true);

                    this.headsApp.ActiveDocument.RefreshDocument();
                }
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
コード例 #7
0
        private void btnOk__Click(object sender, EventArgs e)
        {
            if (ValidateData())
            {
                CBox boundbox = this.hdapp.ActiveDocument.BoundingBox;
                if (boundbox != null)
                {
                    //Delete the existing
                    //ViewerUtils.DeleteEntitiesByLabel(this.hdapp.ActiveDocument, HeadsUtils.Constants.LABEL_CHAINAGE, false);

                    //CCfgtype cfg = this.hdapp.ConfigParam;
                    HeadsUtils.Chainage Chng = new HeadsUtils.Chainage();
                    double z = 0.0;
                    Chng.XMin             = boundbox.TopLeft.X;
                    Chng.YMin             = boundbox.TopLeft.Y;
                    z                     = boundbox.TopLeft.Z;
                    Chng.ModelName        = this.SelectedModelName;
                    Chng.StringName       = this.SelectedStringLabel;
                    Chng.TextSize         = this.tbTextSize_.Value;
                    Chng.ChainageInterval = this.tbChainageInterval_.Value;
                    Chng.Rotation         = 0;

                    BinaryWriter bw = new BinaryWriter(new FileStream(Path.Combine(this.hdapp.AppDataPath, "CHAIN1.TMP"), FileMode.Create), Encoding.Default);
                    bw.Write(ViewerUtils.ConvertStringToByteArray(Chng.ModelName, 30));
                    bw.Write(ViewerUtils.ConvertStringToByteArray(Chng.StringName, 20));
                    bw.Write(Chng.XMin);
                    bw.Write(Chng.YMin);
                    bw.Write(Chng.ChainageInterval);
                    bw.Write(Chng.TextSize);
                    bw.Write(Chng.Rotation);
                    bw.Close();

                    ViewerUtils.DeleteFileIfExists(Path.Combine(this.hdapp.AppDataPath, "CHAIN2.TMP"));

                    CChainageUtil util = new CChainageUtil();
                    util.Funcmain(this.hdapp.AppDataPath);

                    DrawingUtil.DrawChainage(this.hdapp, Path.Combine(this.hdapp.AppDataPath, "CHAIN2.TMP"), "CHAIN", true);

                    this.hdapp.ActiveDocument.RefreshDocument();
                }

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
コード例 #8
0
 private void CclearBtn_Click(object sender, EventArgs e)
 {
     CBox.Clear();
 }
コード例 #9
0
        private void BtnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataType == DataType.Inventory)
                {
                    if (dataManager.GetItemQuantity(storage, GetFromComboBox()) == 0)
                    {
                        if (numUpDown1.Value != 0)
                        {
                            int quantity = Decimal.ToInt32(numUpDown1.Value);
                            dataManager.Insert(GetFromComboBox(), quantity, storage);
                        }
                    }
                    else
                    {
                        if (numUpDown1.Value == 0)
                        {
                            dataManager.Delete(storage, GetFromComboBox());
                        }
                        else
                        {
                            dataManager.Update(storage, GetFromComboBox(), decimal.ToInt32(numUpDown1.Value));
                        }
                    }
                }
                else
                {
                    switch (process)
                    {
                    case Process.Modify:
                        switch (dataType)
                        {
                        case DataType.User:
                            if (txtBox1.Text == txtBox2.Text)
                            {
                                User newUser = GetFromComboBox();
                                newUser.Password                  = txtBox1.Text;
                                newUser.PermitUserManagement      = checkBoxUserPermit.Checked;
                                newUser.PermitCatalogManagement   = checkBoxCatalogPermit.Checked;
                                newUser.PermitStoragesManagement  = checkBoxStoragePermit.Checked;
                                newUser.PermitInventoryManagement = checkBoxInventoryPermit.Checked;
                                dataManager.Update(newUser);
                            }
                            break;

                        case DataType.Storage:
                            Storage dataStorage = GetFromComboBox();
                            dataStorage.Dimensions[0] = decimal.ToInt32(numUpDown1.Value);
                            dataStorage.Dimensions[1] = decimal.ToInt32(numUpDown2.Value);
                            dataManager.Update(dataStorage);
                            break;

                        case DataType.Item:
                            Item dataItem = GetFromComboBox();
                            dataItem.Brand       = txtBox1.Text;
                            dataItem.Model       = txtBox2.Text;
                            dataItem.Description = txtBox3.Text;
                            dataManager.Update(dataItem);
                            break;
                        }
                        break;

                    case Process.Delete:
                        dataManager.Delete(GetFromComboBox());
                        break;
                    }
                }
                if (process == Process.Modify)
                {
                    MessageBox.Show("Cambios guardados exitosamente.");
                }
                else
                {
                    MessageBox.Show("Se elimino el elemento correctamente.");
                }
            }
            catch (Exception error)
            {
                Hide();
                new Message().ShowError(error);
                Show();
            }
            CBox.ResetText();
            UpdateForm();
        }
コード例 #10
0
        public static void ExportToDRG(IHeadsApplication app, string strPath)
        {
            CCfgtype cfg = app.ActiveDocument.ConfigParam;

            CBox box = app.ActiveDocument.BoundingBox;

            double[] Arr = new double[] { box.BottomRight.X, box.BottomRight.Y, box.TopLeft.X, box.TopLeft.Y };

            cfg.XLate_X = Arr[0];
            cfg.XLate_Y = Arr[1];
            cfg.hs      = (297 / (Arr[2] - cfg.XLate_X));

            BinaryWriter bw  = new BinaryWriter(new FileStream(strPath, FileMode.Create), Encoding.Default);
            Eldtype      eld = new Eldtype();

            eld.Code = 99;
            bw.Write(eld.Code);
            cfg.ToStream(bw);
            IHdEntity[] allEntities = app.ActiveDocument.Entities;
            foreach (IHdEntity entity in allEntities)
            {
                if (entity.EntityName == "LINE")
                {
                    IHdLine hdline = (IHdLine)entity;
                    eld.Code = (short)((Constants.BuildType == eHEADS_RELEASE_TYPE.DEMO) ? 91 : 1);
                    bw.Write(eld.Code);

                    Linetype line = new Linetype();

                    line.elatt = 0;
                    line.scatt = 1;
                    line.layer = hdline.Layer;
                    line.laatt = 1;

                    line.x1 = hdline.StartPoint.X;
                    line.y1 = hdline.StartPoint.Y;
                    line.z1 = hdline.StartPoint.Z;

                    line.x1 = line.x1 / cfg.XMetric;
                    line.y1 = line.y1 / cfg.YMetric;

                    line.x2 = hdline.EndPoint.X;
                    line.y2 = hdline.EndPoint.Y;
                    line.z2 = hdline.EndPoint.Z;

                    line.x2 = line.x2 / cfg.XMetric;
                    line.y2 = line.y2 / cfg.YMetric;

                    line.color = entity.ColorIndex;

                    if (hdline.Label == "")
                    {
                        line.label = "$$$$$$$$:****";
                    }
                    else
                    {
                        line.label = hdline.Label;
                    }

                    line.ToStream(bw);
                }
                else if (entity.EntityName == "ELLIPSE")
                {
                    IHdEllipse hdEllipse = (IHdEllipse)entity;
                    eld.Code = (short)((Constants.BuildType == eHEADS_RELEASE_TYPE.DEMO) ? 93 : 3);
                    bw.Write(eld.Code);

                    Circletype circle1 = new Circletype();

                    circle1.elatt = 0;
                    circle1.scatt = 1;
                    circle1.Layer = hdEllipse.Layer;
                    circle1.laatt = 1;

                    circle1.xc = hdEllipse.CenterPoint.X;
                    circle1.yc = hdEllipse.CenterPoint.Y;

                    circle1.xc     = circle1.xc / cfg.XMetric;
                    circle1.yc     = circle1.yc / cfg.YMetric;
                    circle1.Radius = hdEllipse.Radius;

                    circle1.color = entity.ColorIndex;

                    if (hdEllipse.Label == "")
                    {
                        circle1.Label = "$$$$$$$$:****";
                    }
                    else
                    {
                        circle1.Label = hdEllipse.Label;
                    }

                    circle1.ToStream(bw);
                }
                else if (entity.EntityName == "ARC")
                {
                    IHdArc hdArc = (IHdArc)entity;
                    eld.Code = (short)((Constants.BuildType == eHEADS_RELEASE_TYPE.DEMO) ? 94 : 4);
                    bw.Write(eld.Code);

                    Arctype arc = new Arctype();

                    arc.elatt = 0;
                    arc.scatt = 1;
                    arc.Layer = hdArc.Layer;
                    arc.laatt = 1;

                    arc.xc = hdArc.CenterPoint.X;
                    arc.yc = hdArc.CenterPoint.Y;
                    arc.xc = arc.xc / cfg.XMetric;
                    arc.yc = arc.yc / cfg.YMetric;

                    arc.xs     = (arc.xc + hdArc.Radius * Math.Cos(hdArc.StartAngle)) / cfg.XMetric;
                    arc.ys     = (arc.yc + hdArc.Radius * Math.Sin(hdArc.StartAngle)) / cfg.YMetric;
                    arc.xe     = (arc.xc + hdArc.Radius * Math.Cos(hdArc.EndAngle)) / cfg.XMetric;
                    arc.ye     = (arc.yc + hdArc.Radius * Math.Sin(hdArc.EndAngle)) / cfg.YMetric;
                    arc.Radius = hdArc.Radius;

                    arc.Color = entity.ColorIndex;
                    if (hdArc.Label == "")
                    {
                        arc.Label = "$$$$$$$$:****";
                    }
                    else
                    {
                        arc.Label = hdArc.Label;
                    }
                    arc.ToStream(bw);
                }
                else if (entity.EntityName == "POLYLINE3D")
                {
                    IHdPolyline3D hdPline      = (IHdPolyline3D)entity;
                    CPoint3D[]    Coord        = hdPline.Coordinates;
                    int           NumVerticies = Coord.Length - 2;
                    for (int j = 0; j <= NumVerticies; j++)
                    {
                        eld.Code = (short)((Constants.BuildType == eHEADS_RELEASE_TYPE.DEMO) ? 91 : 1);
                        bw.Write(eld.Code);

                        Linetype line = new Linetype();

                        if (j == 0)
                        {
                            line.elatt = 0;
                        }
                        else
                        {
                            line.elatt = 1;
                        }

                        //line.elatt = X;
                        line.scatt = 1;
                        line.layer = hdPline.Layer;
                        line.laatt = 1;

                        line.x1 = Coord[j].X;
                        line.y1 = Coord[j].Y;
                        line.z1 = Coord[j].Z;

                        line.x1 = line.x1 / cfg.XMetric;
                        line.y1 = line.y1 / cfg.YMetric;

                        line.x2 = Coord[j + 1].X;
                        line.y2 = Coord[j + 1].Y;
                        line.z2 = Coord[j + 1].Z;

                        line.x2    = line.x2 / cfg.XMetric;
                        line.y2    = line.y2 / cfg.YMetric;
                        line.color = entity.ColorIndex;

                        if (hdPline.Label == "")
                        {
                            line.label = "$$$$$$$$:****";
                        }
                        else
                        {
                            line.label = hdPline.Label;
                        }

                        line.ToStream(bw);
                    }
                }
                else if (entity.EntityName == "TEXT")
                {
                    IHdText hdTxt = (IHdText)entity;
                    eld.Code = (short)((Constants.BuildType == eHEADS_RELEASE_TYPE.DEMO) ? 90 : 9);
                    bw.Write(eld.Code);

                    TEXTtype text = new TEXTtype();

                    text.Length = 1;
                    text.scatt  = 1;
                    text.Layer  = hdTxt.Layer;
                    text.laatt  = 1;

                    text.x1 = hdTxt.InsertionPoint.X;
                    text.y1 = hdTxt.InsertionPoint.Y;

                    text.x1    = text.x1 / cfg.XMetric;
                    text.y1    = text.y1 / cfg.YMetric;
                    text.Size  = hdTxt.Height;
                    text.rotn  = hdTxt.Rotation * 180 / Math.PI;
                    text.text  = hdTxt.Text;
                    text.Color = entity.ColorIndex;
                    if (hdTxt.Label == "")
                    {
                        text.Label = "$$$$$$$$:****";
                    }
                    else
                    {
                        text.Label = hdTxt.Label;
                    }
                    text.ToStream(bw);
                }
            }

            bw.Close();
        }
コード例 #11
0
        public FJMainForm()
        {
            AppUtil apputil = new AppUtil();

            this.Hide();
            InitializeComponent();
            m_toolbox.Dock = DockStyle.Fill;
            ToolBoxpanelDock.Controls.Add(m_toolbox);
            try
            {
                dotNetBarManager1.LoadLayout(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath),
                                                          "config\\DockPanel.config"));
            }
            catch (Exception)
            {}


            var frm = new SLogoForm();

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                try
                {
                    cSortingTask = new CSortingTask();
                    cSortingTask.OnTaskStatusChanged += new EventHandler <EventArgs>(cSortingTask_OnTaskStatusChanged);
                    cSortingTask.OnTaskStopFinished  += new EventHandler <EventArgs>(cSortingTask_OnTaskStopFinished);
                    cAbnSortingTask = new CAbnSortingTask();
                    CBox            = new CBox();
                    CAbnBox         = new CAbnBox();
                    CSortingMain    = new C_SortingMain();
                    labout.Controls.Add(cSortingTask);
                    panelDockContainer1.Controls.Add(cAbnSortingTask);
                    panelDockContainer2.Controls.Add(CBox);
                    panelDockContainer3.Controls.Add(CAbnBox);
                    panelDockContainer4.Controls.Add(CSortingMain);

                    this.cLog1 = new MonitorMain.CustomContorl.CLog();
                    this.OutPutpanelDock.Controls.Add(this.cLog1);
                    this.cLog1.Dock     = System.Windows.Forms.DockStyle.Fill;
                    this.cLog1.Font     = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                    this.cLog1.Location = new System.Drawing.Point(0, 0);
                    this.cLog1.Name     = "cLog1";
                    this.cLog1.Size     = new System.Drawing.Size(1101, 133);
                    this.cLog1.TabIndex = 0;
                }
                catch (Exception ex)
                {
                    if (ex.Message.Contains("Unable to connect to any of the specified MySQL hosts"))
                    {
                        MessageBox.Show("无法连接到分拣机数据库");
                    }
                    else
                    {
                        throw;
                    }
                }

                Show();
            }
            else
            {
                Process p = Process.GetCurrentProcess();
                p.Kill();
                Application.Exit();
            }
        }