Example #1
0
        static void Main()
        {
            //-----------------------------------
            //1.
            //after we build nodejs in dll version
            //we will get node.dll
            //then just copy it to another name 'libespr'
            string currentdir = System.IO.Directory.GetCurrentDirectory();


            string libEspr = @"../../../node-v13.5.0/out/Release/node.dll";
            //-----------------------------------
            //2. load node.dll
            //-----------------------------------

            IntPtr intptr     = LoadLibrary(libEspr);
            int    errCode    = GetLastError();
            int    libesprVer = JsBridge.LibVersion;

#if DEBUG
            JsBridge.dbugTestCallbacks();
#endif
            //------------
            MyApp myApp = new MyApp();
            NodeJsEngineHelper.Run(new string[] { "--inspect", "hello.espr" },
                                   ss =>
            {
                ss.SetExternalObj("myApp", myApp);

                return(@" const http2 = require('http2');
                    const fs = require('fs');
                    
                    const server = http2.createSecureServer({
                      key: fs.readFileSync('localhost-privkey.pem'),
                      cert: fs.readFileSync('localhost-cert.pem')
                    });
                    server.on('error', (err) => console.error(err));
                    server.on('socketError', (err) => console.error(err));

                    server.on('stream', (stream, headers) => {
                      // stream is a Duplex
                      //const method = headers[':method'];
                      //const path = headers[':path'];  
                       
                      //let result=  myApp.HandleRequest(method,path);
                      
                      //stream.respond({
                      //  'content-type': 'text/html',
                      //  ':status': 200
                      //});
                      stream.end('<h1>Hello World, EspressoND, node 12.11.1</h1>'+ myApp.GetMyName());
                      //stream.end(result);
                    });

                    server.listen(8443);
                    console.log('hello!');
                    ");
            });
            string userInput = Console.ReadLine();
        }
Example #2
0
        public void Execute()
        {
            // Read task body
            string taskMessageBody;

            using (var receiveStream = this.Request.Body)
            {
                using (var sr = new StreamReader(receiveStream, Encoding.UTF8))
                {
                    taskMessageBody = sr.ReadToEnd();
                }
            }

            string projectId        = this.Request.Headers["ProjectId"];
            string planId           = this.Request.Headers["PlanId"];
            string jobId            = this.Request.Headers["JobId"];
            string timelineId       = this.Request.Headers["TimelineId"];
            string taskInstanceId   = this.Request.Headers["TaskInstanceId"];
            string hubName          = this.Request.Headers["HubName"];
            string taskInstanceName = this.Request.Headers["TaskInstanceName"];
            string planUrl          = this.Request.Headers["PlanUrl"];
            string authToken        = this.Request.Headers["AuthToken"];

            // Ensure projectId, planId, jobId, timelineId, taskInstanceId are proper guids.

            // Handover time consuming work to another task. Completion event should be set to "Callback" in pipeline task.
            Task.Run(() => MyApp.ExecuteAsync(taskMessageBody, projectId, planUrl, hubName, planId, jobId, timelineId, taskInstanceId, taskInstanceName, authToken));
        }
        //
        //         private Task CreateApplication ( Assembly theAssembly )
        //         {
        //             Application theApp ;
        //             App myApp = null ;
        //             if ( LoadRealApp )
        //             {
        //                 Logger?.Debug ( "Creating real app" ) ;
        //                 try
        //                 {
        //                     void doApp ( )
        //                     {
        //                         theApp              = myApp = new App ( ) ;
        //                         MyApp               = myApp ;
        //                         theApp.ShutdownMode = ShutdownMode.OnExplicitShutdown ;
        //                         theApp.Run ( ) ;
        //                     }
        //
        //                     myApp = new App ( ) ;
        //                     myApp.DoOnStartup ( Array.Empty<string> ( ) ) ;
        //                     return Task.CompletedTask ;
        //                 }
        //                 catch ( Exception ex )
        //                 {
        //                     Logger?.Error ( ex , ex.Message ) ;
        //
        //                     throw ex ;
        //                 }
        //
        // #if XX
        //                 Action < Application > runAction = application => application.Run ( ) ;
        //                 var dispatcherOperation =
        //                     myApp.Dispatcher.BeginInvoke ( DispatcherPriority.Send , runAction , myApp ) ;
        //                 Op = dispatcherOperation ;
        // #endif
        //
        //                 //myApp.AppInitialize();
        //                 // var thread = new Thread (
        //                 // o => {
        //                 // ( ( Application ) o ).Run ( ) ;
        //                 // }
        //                 // ) ;
        //                 // thread.Start(myApp);
        //             }
        //             else
        //             {
        //                 MyApp = new Application ( ) ;
        //                 return Task.CompletedTask ;
        //             }
        //         }
        //         //
        //         //
        //         // CurAssembly =
        //         //       theAssembly ?? throw new ArgumentNullException ( nameof ( theAssembly ) ) ;
        //         //
        //         //   var assemblyFullName = CurAssembly.FullName ;
        //         //   var assPart = Uri.EscapeUriString ( CurAssembly.GetName ( ).Name ) ;
        //         //   var uri = new Uri (
        //         //                      $"pack://application:,,,/{assPart};component/"
        //         //                    , UriKind.RelativeOrAbsolute
        //         //                     ) ;
        //         //   BasePackUri = uri ;
        //         //   System.Diagnostics.Debug.WriteLine ( "URI is " + BasePackUri ) ;
        //         //   MyApp = theApp ;
        //         //   return null ;
        //         // }

        //[Test(), Apartment(ApartmentState.STA)]
        // ReSharper disable once UnusedMember.Global
        /// <summary>Makes the window wrap.</summary>
        /// <param name="genericType">Type of the generic.</param>
        /// <param name="wrappedType">Type of the wrapped.</param>
        /// <exception cref="System.ArgumentNullException">genericType
        /// or
        /// wrappedType</exception>
        /// <autogeneratedoc />
        /// TODO Edit XML Comment Template for MakeWindowWrap
        public void MakeWindowWrap(Type genericType, Type wrappedType)
        {
            if (genericType == null)
            {
                throw new ArgumentNullException(nameof(genericType));
            }

            if (wrappedType == null)
            {
                throw new ArgumentNullException(nameof(wrappedType));
            }

            try
            {
                var wrapType = genericType.MakeGenericType(wrappedType);
                var wrap     = Activator.CreateInstance(wrapType) as WindowWrap <Visual>;
                MyApp.Run(wrap);
            }
            catch (XamlParseException e)
            {
                Console.WriteLine(e.Message);
                throw;
            }
            catch (Exception e)
            {
                Logger.Debug(e, $"{e.Message}");
                Console.WriteLine(e);
                throw;
            }
        }
Example #4
0
    GameObject NetAddBuild(int BInd, Vector3 VT) //添加Item perfab
    {
        GameObject m_Obj = Instantiate(Resources.Load("Prefab/HouseMenu/BuildingList")) as GameObject;

        m_Obj.transform.parent        = GameObject.Find("HouseList").transform;
        m_Obj.transform.localScale    = Vector3.one;
        m_Obj.transform.localPosition = VT;
        m_Obj.name = "B" + BInd.ToString();

        //挂在外部对象
        m_Obj.GetComponent <BuyBuilding>().m_HouseMenu = m_HouseMenu;
        m_Obj.GetComponent <BuyBuilding>().m_CameraMap = m_CameraMap;
        m_Obj.GetComponent <BuyBuilding>().m_ResList   = m_ResList;

        var BList = from n in MyApp.GetInstance().GetDataManager().BB()
                    where n.BType == BInd
                    where n.Lv == 1
                    select new { B_ATLAS_NAME = n.Atlas, B_ICON_NAME = n.Icon, B_NAME = n.Name, BUILD_STR = n.InfoStr, n.ID };

        foreach (var BLi in BList)
        {
            //Debug.Log("BLi.Batlasname = " + BLi.Batlasname);
            //Debug.Log("BLi.Biconname = " + BLi.Biconname);

            UIAtlas UA = Resources.Load("Atlas/House/" + BLi.B_ATLAS_NAME, typeof(UIAtlas)) as UIAtlas;
            m_Obj.transform.FindChild("HouseIcon").GetComponent <UISprite>().atlas      = UA;
            m_Obj.transform.FindChild("HouseIcon").GetComponent <UISprite>().spriteName = BLi.B_ICON_NAME;
            m_Obj.transform.FindChild("HouseName").GetComponent <UILabel>().text        = BLi.B_NAME;;
            m_Obj.transform.FindChild("BID").GetComponentInChildren <UILabel>().text    = BLi.ID.ToString();
            m_Obj.transform.FindChild("HouseInfo").GetComponent <UILabel>().text        = BLi.BUILD_STR;
        }

        return(m_Obj);
    }
Example #5
0
        public MainWindow()
        {
            InitializeComponent();
            ApplicationConfiguration config;

            if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + MyApp.FILE_NAME))
            {
                config = ApplicationConfiguration.Default;
            }
            else
            {
                string json = FileManager.Read(AppDomain.CurrentDomain.BaseDirectory + MyApp.FILE_NAME);
                config = JSONSerializer.Deserialize <ApplicationConfiguration>(json);
            }
            Configuration = config;

            myApp       = new MyApp(config);
            DataContext = this.myApp;

            myApp.MainColor.PropertyChanged += (sender, e) => {
                rct_blended.Fill = new SolidColorBrush((sender as ColorWrapper).ToColor());
                rct_blue.Fill    = new SolidColorBrush((sender as ColorWrapper).BlueBalance);
                rct_green.Fill   = new SolidColorBrush((sender as ColorWrapper).GreenBalance);
                rct_red.Fill     = new SolidColorBrush((sender as ColorWrapper).RedBalance);
            };

            myApp.AppServer.OnMessageReceived += (message) => {
                MessageBox.Show(message);
            };
        }
Example #6
0
 public void ToggleBackButton(bool state)
 {
     MyApp.ExecuteOnUI(delegate()
     {
         Button_Back.Visibility = (state ? Visibility.Visible : Visibility.Hidden);
     });
 }
Example #7
0
 public void SetTitle(string title)
 {
     MyApp.ExecuteOnUI(delegate()
     {
         WindowTitler.Text = title;
     });
 }
Example #8
0
 public void ToggleCloseButton(bool state)
 {
     MyApp.ExecuteOnUI(delegate()
     {
         Button_Close.IsEnabled = state;
     });
 }
Example #9
0
 public void SetStatus(string statusText)
 {
     MyApp.ExecuteOnUI(delegate()
     {
         Status.Text = statusText;
     });
 }
    public static void Run(Form startupform)
    {
        _myapp = new MyApp(startupform);

        _myapp.StartupNextInstance += new Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventHandler(_myapp_StartupNextInstance);
        _myapp.Run(Environment.GetCommandLineArgs());
    }
Example #11
0
 static void InitializeWindows()
 {
     //WinApp = new Application();
     //WinApp.ShutdownMode = ShutdownMode.OnLastWindowClose;
     WinApp = new MyApp();
     WinApp.InitializeComponent();
 }
Example #12
0
        public void StartPulseAnim(int min = 5, int max = 10, double secPulse = 0.5)
        {
            MyApp.ExecuteOnUI(delegate()
            {
                TimeSpan pulseTime = TimeSpan.FromSeconds(secPulse);

                Storyboard sb = new Storyboard()
                {
                    RepeatBehavior = RepeatBehavior.Forever
                };

                var anim         = new DoubleAnimation(min, max, new Duration(pulseTime));
                var anim_reverse = new DoubleAnimation(max, min, new Duration(pulseTime))
                {
                    BeginTime = pulseTime
                };

                sb.Children.Add(anim);
                sb.Children.Add(anim_reverse);

                Storyboard.SetTarget(anim, Circle);
                Storyboard.SetTarget(anim_reverse, Circle);

                Storyboard.SetTargetProperty(anim, new PropertyPath(Shape.StrokeThicknessProperty));
                Storyboard.SetTargetProperty(anim_reverse, new PropertyPath(Shape.StrokeThicknessProperty));

                sb.Begin();
            });
        }
Example #13
0
        public void Attach(IntPtr windowHandle)
        {
            if (windowHandle.Equals(IntPtr.Zero))
            {
                //_logger.Error("Make sure BDO isn't initially minimized and this application is running as admin.");
                //Debug.WriteLine("could not pinvoke!");
                MessageBox.Show("Make sure BDO isn't initially minimized and this application is running as admin.", "Could not attach to BDO", MessageBoxButton.OK, MessageBoxImage.Error);
                MyApp.exit();
            }
            else
            {
                WindowHandle = windowHandle;
                var r = GetWindowArea();
                Size = new Size
                {
                    Width  = r.Width,
                    Height = r.Height
                };

                Config = ScreenConfig.LoadFromFile($"{Size.Width}x{Size.Height}");

                _overlay = new Overlay(_notifier, _container);

                _windowEventHook = new WindowObserver(windowHandle, ObservedWindowEvent);
                User32.SetForegroundWindow(windowHandle);

                _overlay.Update(r);
                _overlay.Topmost = true;
            }
        }
Example #14
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            _window = new UIWindow();
            var app = new MyApp();

            IView content = app.CreateView();

            _window.RootViewController = new UIViewController
            {
                View = content.ToNative()
            };

            _window.MakeKeyAndVisible();

            // In 5 seconds, add and remove some controls so we can see that working
            Task.Run(async() => {
                await Task.Delay(5000).ConfigureAwait(false);

                void addLabel()
                {
                    (content as VerticalStackLayout).Add(new Label {
                        Text = "I show up after 5 seconds"
                    });
                    var first = (content as VerticalStackLayout).Children.First();
                    (content as VerticalStackLayout).Remove(first);
                };

                _window.BeginInvokeOnMainThread(addLabel);
            });

            return(true);
        }
Example #15
0
 public void StopPulseAnim()
 {
     MyApp.ExecuteOnUI(delegate()
     {
         Circle.BeginAnimation(Shape.StrokeThicknessProperty, null);
     });
 }
Example #16
0
        private static void StartConsole()
        {
            MyApp myApp = new MyApp();

            myApp.StartProcessing();
            Console.ReadLine();
        }
Example #17
0
        /// <summary>
        /// Thực thi đăng nhập
        /// </summary>
        /// <param name="sSql"></param>
        private void btnCommit_Click(object sender, EventArgs e)
        {
            #region Kiểm tra thông tin đầu vào
            if (txtOLDpass.Text != UserInformation.Pass)
            {
                MessageBox.Show("Mật khẩu cũ sai", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
            }
            if (txtNEWpass.Text != txtNEWpasscheck.Text)
            {
                MessageBox.Show("Xác nhận mật khẩu sai", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
            }
            if (txtNEWpass.Text == txtOLDpass.Text)
            {
                MessageBox.Show("Mật khẩu mới không được giống mật khẩu cũ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
            }
            if (txtNEWpass.Text == "")
            {
                MessageBox.Show("Mật khẩu không được trống", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
            }
            #endregion

            string sql = "PASS_CHANGE '" + UserInformation.Code + "' , '" + txtNEWpass.Text + "'";
            int    _ok = DatLoa.AddNew(sql);
            if (_ok >= 0)
            {
                MyApp.MSSQLConnectionString = MyApp.GetLoginMSSQL(MyApp.gHostDB, MyApp.gServiceNameDB, MyApp.gUserDB, txtNEWpass.Text);
                UserInformation.Pass        = txtNEWpass.Text;
                this.DialogResult           = DialogResult.OK;
                this.Close();
            }
        }
 public HttpResponseMessage GetSomePdf(string id)
 {
     var path = MyApp.PathToSomePdf(id);
     if (path!= null)
         return FileAsAttachment(path, "somepdf.pdf");
     return new HttpResponseMessage(HttpStatusCode.NotFound);
 }
Example #19
0
        //---------------------------------------------------------------------
        private void SaveData()
        {
            m_aXML.SetValue("/USBWatch/USBInfo/CameraName", txtCamera.Text.Trim());
            m_aXML.SetValue("/USBWatch/USBInfo/PrinterName", txtPrinter.Text.Trim());

            m_aXML.SaveFile(m_szFileXML);

            MyApp.SetNodeValue("/AppData/MachineNo", this.MachineNo.ToString());
            MyApp.SetNodeValue("/AppData/CodeNo", txtCodeNo.Text.Trim());
            MyApp.SetNodeValue("/AppData/DeviceID", txtDeviceID.Text.Trim());
            MyApp.SetNodeValue("/AppData/ShopName", txtShopName.Text.Trim());
            MyApp.SetNodeValue("/AppData/PhotoCount", m_szPhotoCount.Trim());

            if (MyString.CInt(m_szPhotoCount) == 0)
            {
                string szToday = DateTime.Now.ToString("yyyy-MM-dd");
                MyApp.SetNodeValue("/AppData/StartDate", szToday);
            }

            MyApp.Save();

            string buf = MyApp.Path + @"Sys\Setup.xml";

            MyXML aXML = new MyXML();

            aXML.LoadFile(buf);

            aXML.SetValue("/Setup/PrintHeaderInfo/ShopName", txtShopName.Text.Trim());
            aXML.SetValue("/Setup/PrintHeaderInfo/CodeNo", txtCodeNo.Text.Trim());
            aXML.SetValue("/Setup/PrintHeaderInfo/MachineNo", txtDeviceID.Text.Trim());

            aXML.SaveFile(buf);
        }
Example #20
0
        //---------------------------------------------------------------------
        private void CheckUpdate()
        {
            string lastUpdate = MyApp.GetNodeValue("/AppData/LastUpdate");

            MyWebPage myWebPage = new MyWebPage(MyApp.HostIP);

            if (myWebPage.PingHost())
            {
                string szURL = MyApp.WebSite + "/api/CheckUpdate.php";
                string param = "no=" + m_nMachineNo.ToString() + "&t1=" + lastUpdate;

                string buf = myWebPage.GetResponseString(szURL, param);
                if (buf != "")
                {
                    string[] aAry = buf.Split(',');
                    for (Int32 i = 0; i < aAry.Length; i += 2)
                    {
                        DownFile(aAry[i], aAry[i + 1]);   // 下載檔案並更新。
                    }
                    listBox1.Items.Add("Update OK!");
                    lastUpdate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                    MyApp.SetNodeValue("/AppData/LastUpdate", lastUpdate);
                    MyApp.Save();
                }
                else
                {
                    listBox1.Items.Add("No Updated");
                }
            }
        }
Example #21
0
 public void StopRotateAnim()
 {
     MyApp.ExecuteOnUI(delegate()
     {
         CenterForm.BeginAnimation(RotateTransform.AngleProperty, null);
     });
 }
Example #22
0
 public void SetInnerBrush(Color clr)
 {
     MyApp.ExecuteOnUI(delegate()
     {
         Circle.Fill = new SolidColorBrush(clr);
     });
 }
Example #23
0
    static void Main()
    {
        MyApp application = new MyApp();

        application.Initialise();
        Application.Run(application.MainForm);
    }
Example #24
0
        public static string LoginApp(
            string host, string port, string servicename, string userdb, string pwddb,
            string username, string password)
        {
            string     result = "Lỗi đăng nhập.";
            DataAccess dbA    = new DataAccess();

            MyApp.MSSQLConnectionString = MyApp.GetLoginMSSQL(host, servicename, userdb, pwddb);
            dbA.ConnectionString        = MyApp.MSSQLConnectionString;
            string sql = "SELECT code From [User] WHERE code='" + username + "' and SDUNG = 'C'";
            List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >();

            try
            {
                DbDataReader reader = dbA.ExecuteAsDataReaderSql(sql, ParaMeterCollection);
                if (reader.Read())
                {
                    result = "true";
                }
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }
            return(result);
        }
Example #25
0
 public override object GetResult()
 {
     MainContent.Add(new MyImage("logo"));
     BeginWaiting(() => {
         MyApp.Execute("Login");
     });
     return(base.GetResult());
 }
Example #26
0
 public void Configuration(IAppBuilder app)
 {
     // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=316888
     app.Map("/WebMethods", MyApp =>
     {
         MyApp.UseSpotifyAuthentication();
     });
 }
 public static KeyValuePair<HttpContext, HttpApplication> GetContext(HttpWorkerRequest wr, params IHttpModule[] modules) {
     var ctx = new HttpContext(wr);
     var app = new MyApp(modules);
     SetHttpApplicationFactoryCustomApplication(app);
     InitInternal(app, ctx);
     AssignContext(app, ctx);
     return new KeyValuePair<HttpContext, HttpApplication>(ctx, app);
 }
Example #28
0
        public ViewController(IntPtr handle) : base(handle)
        {
            var app = new MyApp();

            IView content = app.CreateView();

            View = content.ToNative();
        }
Example #29
0
 //---------------------------------------------------------------------
 public frmMain()
 {
     InitializeComponent();
     if (!MyApp.Init())
     {
         this.Close();
     }
 }
 public static void Main()
 {
     if (activeInstance == null)
     {
         activeInstance = new MyApp();
         Application.Run(activeInstance);
     }
 }
    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);

        var myApp = new MyApp();

        myApp.Start();
    }
Example #32
0
            public override void EstablishContext()
            {
                StinkFlyProcessor processor = new StinkFlyProcessor();
                StinkFlyApplication.Builder = processor;

                app = new MyApp();
                _response = processor.Process("/hello/chris");
            }
Example #33
0
    public static void Main()
    {
        string[] args = new string[0];
        MyApp app = new MyApp();

        MyApp.SetInstance(app);
        bool ret = wxsharpglue.wxEntry(args);
        if (ret)
            Console.WriteLine ("wxEntry return true, ok");
        else
            Console.WriteLine ("wxEntry return false, something bad");

        Console.WriteLine ("The end!");
    }
Example #34
0
    static void Main()
    {
        //Create an object of MyApp
        MyApp app = new MyApp();

        //And "glue" this object reference to User, Admin,Clerk
        User u = app;
        u.show();

        Admin a = app;
        a.del();
        a.add();

           // doUser(app);  // pass via interface parameter
           // doSuper(app);
    }
Example #35
0
 static void Main()
 {
     MyApp app = new MyApp();
     app.Run();
 }