Exemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            _select();
            button2.Visible    = false;
            pic_giai.Image     = Image.FromFile("1.png");
            output_box.Font    = new Font("Arial", 9);
            output_box.Enabled = true;
            hd.Image           = Image.FromFile("hd2.jpg");
            MapleEngine.MapleCallbacks cb;
            IntPtr kv;

            byte[]   err  = new byte[2048];
            String[] argv = new String[2];
            argv[0]             = "maple";
            argv[1]             = "-A2";
            cb.textCallBack     = cbText;
            cb.errorCallBack    = cbError;
            cb.statusCallBack   = cbStatus;
            cb.readlineCallBack = null;
            cb.redirectCallBack = null;
            cb.streamCallBack   = null;
            cb.queryInterrupt   = null;
            cb.callbackCallBack = null;

            try
            {
                kv = MapleEngine.StartMaple(2, argv, ref cb, IntPtr.Zero, IntPtr.Zero, err);
            }
            catch (DllNotFoundException e)
            {
                System.Windows.Forms.MessageBox.Show(e.ToString());
                return;
            }
            catch (EntryPointNotFoundException e)
            {
                System.Windows.Forms.MessageBox.Show(e.ToString());
                return;
            }
            try
            {
                MapleEngine.EvalMapleStatement(kv, Encoding.ASCII.GetBytes("with(abc):"));
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
                return;
            }
        }
Exemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            MapleEngine.MapleCallbacks cb;
            IntPtr kv;

            byte[]   err  = new byte[2048];
            String[] argv = new String[2];
            argv[0]             = "maple";
            argv[1]             = "-A2";
            cb.textCallBack     = cbText;
            cb.errorCallBack    = cbError;
            cb.statusCallBack   = cbStatus;
            cb.readlineCallBack = null;
            cb.redirectCallBack = null;
            cb.streamCallBack   = null;
            cb.queryInterrupt   = null;
            cb.callbackCallBack = null;

            try
            {
                kv = MapleEngine.StartMaple(2, argv, ref cb, IntPtr.Zero, IntPtr.Zero, err);
            }
            catch (DllNotFoundException xe)
            {
                System.Windows.Forms.MessageBox.Show(xe.ToString());
                return;
            }
            catch (EntryPointNotFoundException xe)
            {
                System.Windows.Forms.MessageBox.Show(xe.ToString());
                return;
            }
            try
            {
                MapleEngine.EvalMapleStatement(kv, Encoding.ASCII.GetBytes("with(abc):"));
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
                return;
            }
        }
Exemplo n.º 3
0
        public void blPT2()
        {
            output_box.Text = "";
            MapleEngine.MapleCallbacks cb;
            byte[] err = new byte[2048];
            IntPtr kv;

            String[] argv = new String[2];
            argv[0] = "maple";
            argv[1] = "-A2";

            cb.textCallBack     = cbText;
            cb.errorCallBack    = cbError;
            cb.statusCallBack   = cbStatus;
            cb.readlineCallBack = null;
            cb.redirectCallBack = null;
            cb.streamCallBack   = null;
            cb.queryInterrupt   = null;
            cb.callbackCallBack = null;
            try
            {
                kv = MapleEngine.StartMaple(2, argv, ref cb, IntPtr.Zero, IntPtr.Zero, err);
                try
                {
                    //sử dụng hàm Tong trong package TEST
                    String expr = "blpt2(";
                    expr += input_box.Text;
                    expr += ",x);";
                    string t;
                    t = expr.ToLower();
                    //MessageBox.Show(t);
                    IntPtr val = MapleEngine.EvalMapleStatement(kv, Encoding.ASCII.GetBytes(expr));
                }
                catch (Exception)
                {
                    MessageBox.Show("Không thể load Maple", "Lỗi", MessageBoxButtons.OK);
                }
            }
            catch (Exception)
            {
            }
        }