コード例 #1
0
ファイル: PreviewGrind.aspx.cs プロジェクト: John1900/G-Cam
        private void display(double alpha)
        {
            DrawCam dc = new DrawCam();
            dc.drawGrinder(alpha, chkZoom.Checked);
            System.Drawing.Image image = dc.getImage();

            Guid guid = Guid.NewGuid();
            string id = guid.ToString();
            String name = "/Temporary/" + guid.ToString() + ".png";
            image.Save(Server.MapPath("~") + name, ImageFormat.Png);

            imgMain.ImageUrl = ".." + name;
        }
コード例 #2
0
ファイル: ucGeometry.ascx.cs プロジェクト: John1900/G-Cam
        private bool buildGraphics(String guid)
        {
            lblErrHead.Visible = false;

            try
            {
                // Cleanup all the old graphics files
                try
                {
                    DirectoryInfo downloadedMessageInfo = new DirectoryInfo(Server.MapPath("~") + "/Temporary/");
                    foreach (FileInfo file in downloadedMessageInfo.GetFiles())
                    {
                        file.Delete();
                    }
                }
                catch (Exception ee)
                {
                }

                DrawCam dc = new DrawCam();
                dc.drawCam();
                System.Drawing.Image image = dc.getImage();

                String name = "/Temporary/A" + guid + ".png";
                image.Save(Server.MapPath("~") + name, ImageFormat.Png);

                DrawAcceleration da = new DrawAcceleration();
                System.Drawing.Image image1 = null;

                if (radioType.SelectedValue.Equals("L")) { image1 = da.drawLift(); }
                if (radioType.SelectedValue.Equals("V")) { image1 = da.drawVelocity(); }
                if (radioType.SelectedValue.Equals("A")) { image1 = da.drawAcceleration(); }
                if (radioType.SelectedValue.Equals("G")) { image1 = da.drawGrinder(); }

                name = "/Temporary/B" + radioType.SelectedValue + guid + ".png";
                image1.Save(Server.MapPath("~") + name, ImageFormat.Png);

                HttpContext.Current.Session["da"] = da;

                return true;
            }
            catch (Exception ee)
            {
                lblError.Text = "Impossible geometry, cannot be modelled!";
                lblErrHead.Visible = true;
                return false;
            }
        }