Example #1
0
        protected override void Authorize()
        {
            WindowThreadOptions <WebView> windowThreadOptions = new WindowThreadOptions <WebView>
            {
                WindowInitialization = window =>
                {
                    window.Title        = "Spotify Authorization";
                    window.AllowedHosts = new List <string> {
                        "accounts.spotify.com", "localhost", string.Empty
                    };
                    window.SetSize(new Size(475, 512));
                },
                BeforeWindowShownAction = window =>
                {
                    window.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                    {
                        AuthorizationCodeFlow.Authorize(url => window.NavigateTo(url), this.Scopes, this.State, this.ShowDialog, "en");
                    }));
                },
                OnWindowClosingAction = window => this.abortAuthEvent.Set()
            };

            this.webViewWindowThread = ThreadManager.Instance.CreateWindowThread(ApartmentState.STA, windowThreadOptions);
            this.webViewWindowThread.IsBackground = true;
            this.webViewWindowThread.ThreadName   = $"{nameof(ToastifyWebAuth)}_{nameof(WebView)}_Thread";
            this.webViewWindowThread.Start();
        }
Example #2
0
        private void btnProcessed_MouseDoubleClick_1(object sender, MouseButtonEventArgs e)
        {
            WindowThread.start();
            clGlobal.lsreturnShow = cReturnTbl.GetReturnTbl();
            clGlobal.AllReturn    = "";
            wndProcessedReturn nRMA = new wndProcessedReturn();

            nRMA.Show();

            this.Close();
        }
        internal static void Launch()
        {
            if (Current != null)
            {
                return;
            }

            WindowThread <DebugView> thread = ThreadManager.Instance.CreateWindowThread <DebugView>(ApartmentState.STA);

            thread.IsBackground = true;
            thread.ThreadName   = $"{nameof(DebugView)}_Thread";
            thread.Start();
        }
Example #4
0
        private void btnReturn_MouseDoubleClick_1(object sender, MouseButtonEventArgs e)
        {
            WindowThread.start();
            clGlobal.lsreturnShow = cReturnTbl.GetReturnTbl();// select so).OrderByDescending(x => x.RGAROWID);

            clGlobal.AllReturn = "AllReturn";

            wndProcessedReturn nRMA = new wndProcessedReturn();

            nRMA.Show();
            // nRMA.Topmost = true;

            this.Close();
        }
        /// <summary>
        /// Lock the Screen and show shipment window.
        /// </summary>
        private void _show_Shipment()
        {
            try
            {
                Boolean _return = false;
                //lock the shipment that is under packing process.
                if (Global.Mode == "SameUser")
                {
                    _return = _shipmentLock(2);
                }
                else if (Global.Mode == "Override")
                {
                    _return = _shipmentLock(1);
                }
                else
                {
                    _return = _shipmentLock(0);
                }
                if (_return)
                {
                    //Start please wait screen in saprate thread.
                    WindowThread.start();

                    //Set the Global Shiment Number
                    Global.ShippingNumber = txtShipmentId.Text.ToUpper();

                    ShipmentScreen shipmentScreen = new ShipmentScreen();

                    //loger add log.
                    SaveUserLogsTbl.logThis(csteActionType.ShipmentID_Scan.ToString(), Global.ShippingNumber.ToString());
                    _scrollMsg("Valid Shipment Scanned. Shipment ID =" + Global.ShippingNumber, Color.FromRgb(38, 148, 189));

                    shipmentScreen.Show();

                    //close thi screen.
                    this.Close();
                }
                else
                {
                    _scrollMsg("Warning: shipping information not available. Please scan another shipment.", Color.FromRgb(222, 87, 24));
                    txtShipmentId.Text = "";
                }
            }
            catch (Exception Ex)
            {
                //Log the Error to the Error Log table
                ErrorLoger.save("wndShipmentScanPage - _show_Shipment", " [" + DateTime.UtcNow.ToString() + "]" + Ex.ToString(), DateTime.UtcNow, Global.LoggedUserId);
            }
        }
Example #6
0
        /// <summary>
        /// manager Override Option Result
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtUserName_KeyDown(object sender, KeyEventArgs e)
        {
            //Logout expire timer RE-start
            SessionManager.StartTime();
            try
            {
                if (e.Key == Key.Enter)
                {
                    if (txtUserName.Text != "")
                    {
                        List <cstUserMasterTbl> _lsUser = Global.controller.GetSelcetedUserMaster(txtUserName.Text);

                        if (Global.controller.CanOverrideShipment(_lsUser[0].UserID))
                        {
                            Global.ManagerID   = _lsUser[0].UserID;
                            Global.ManagerName = _lsUser[0].UserFullName;
                            Global.Mode        = "Override";

                            SessionManager.Autotimer.Stop();
                            //wait screen;
                            WindowThread.start();
                            ShipmentLock(1);
                            ShipmentScreen _ShipmentScreen = new ShipmentScreen();
                            _ShipmentScreen.Show();

                            App.Current.Windows[0].Close();
                            this.Close();
                        }
                        else
                        {
                            Global.ManagerName   = "";
                            LblTitle.Content     = Global.controller.ConvetLanguage("Access Denied.", Global.LanguageFileName);
                            lblmsg.Text          = Environment.NewLine + Environment.NewLine + Global.controller.ConvetLanguage("         You are not authorized to override. ", Global.LanguageFileName);
                            txtUserName.Text     = "";
                            btnCancel.Visibility = System.Windows.Visibility.Hidden;
                            btnOK.Visibility     = System.Windows.Visibility.Visible;
                            btnOK.Focus();
                        }
                    }
                    else
                    {
                        lblmsg.Text      = Environment.NewLine + Environment.NewLine + Global.controller.ConvetLanguage("               Please rescan badge. ", Global.LanguageFileName);
                        txtUserName.Text = "";
                    }
                }
            }
            catch (Exception)
            { }
        }
Example #7
0
        public SocketManager CreateSocketManager()
        {
            if (maxClients <= 0)
                return null;

            socketManager = new SocketManager(maxClients, settings.Port);
            socketManager.Start();

            WindowThread<ProgressWindow> windowThread = new WindowThread<ProgressWindow>();
            windowThread.Update(p => p.Closed += (sender, args) => Cancel());
            windowThread.Start();

            while (socketManager.CountClients < maxClients)
            {
                windowThread.Update(p => p.StatusText.Text = string.Format("Waiting for {0} players..",
                                                                           maxClients -
                                                                           socketManager.CountClients));
                if (windowThread.IsClosed())
                {
                    socketManager.Stop();
                    Cancel();
                    break;
                }

                if (socketManager.HasIncoming)
                {
                    SocketHandler player = socketManager.ConnectPlayer();
                    windowThread.Update(p => p.StatusText.Text = "Waiting for name..");
                    string playerName = player.WaitForName();
                    windowThread.Update(p => p.List.Children.Add(new TextBlock { Text = playerName }));
                }
                Thread.Sleep(10);
            }
            windowThread.Stop();
            return socketManager;
        }
Example #8
0
        public SocketManager CreateSocketManager()
        {
            if (maxClients <= 0)
                return null;

            socketManager = new SocketManager(maxClients, settings.Port);
            socketManager.Start();

            WindowThread<ProgressWindow> windowThread = new WindowThread<ProgressWindow>();
            windowThread.Update(p => p.Closed += (sender, args) => Cancel());
            windowThread.Start();

            while (socketManager.CountClients < maxClients)
            {
                windowThread.Update(p => p.StatusText.Text = string.Format("Waiting for {0} players..",
                                                                           maxClients -
                                                                           socketManager.CountClients));
                if (windowThread.IsClosed())
                {
                    socketManager.Stop();
                    Cancel();
                    break;
                }

                if (socketManager.HasIncoming)
                {
                    SocketHandler player = socketManager.ConnectPlayer();
                    windowThread.Update(p => p.StatusText.Text = "Waiting for name..");
                    string playerName = player.WaitForName();
                    windowThread.Update(p => p.List.Children.Add(new TextBlock { Text = playerName }));
                }
                Thread.Sleep(10);
            }
            windowThread.Stop();
            return socketManager;
        }
Example #9
0
        private void txtScan_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                Application.Current.Dispatcher.BeginInvoke((ThreadStart) delegate()
                {
                    ScannProgressBarStart();
                });
                if (txtScan.Text.Trim() != "") //if clear text box.
                {
                    String TempRMANumber = txtScan.Text.ToUpper();
                    //call constructor of Return Model.
                    _mReturn = new mReturnDetails(txtScan.Text.ToUpper());

                    //keeps deep copy throughout project to access.
                    clGlobal.mReturn = _mReturn;

                    if (_mReturn.IsValidNumber) //Is number valid or not.
                    {
                        this.Dispatcher.Invoke(new Action(() =>
                        {
                            WindowThread.start();
                            //Create new instance of window.
                            wndSrNumberInfo wndMain = new wndSrNumberInfo();
                            mRMAAudit.logthis(_mUser.UserInfo.UserID.ToString(), eActionType.ValidRMANumberScan.ToString(), DateTime.UtcNow.ToString(), _mReturn.EnteredNumber);
                            //opens new window.
                            wndMain.Show();
                        }));

                        //close this screen.
                        this.Close();
                    }
                    else
                    {
                        if (txtScan.Text.ToUpper().Contains("RGA"))
                        {
                            Views.clGlobal.NewRGANumber = txtScan.Text.ToUpper();
                            var retunbyrow = _mponumner.GetReturnByRowID(txtScan.Text.ToUpper())[0];

                            if (retunbyrow.OrderNumber == "N/A")
                            {
                                this.Dispatcher.Invoke(new Action(() =>
                                {
                                    WindowThread.start();
                                    Views.clGlobal.IsAlreadySaved = true;
                                    //Create new instance of window.
                                    wndNewRMANumber wndMain = new wndNewRMANumber();
                                    mRMAAudit.logthis(_mUser.UserInfo.UserID.ToString(), "Valid_RGANumber_Scan", DateTime.UtcNow.ToString(), _mReturn.EnteredNumber);
                                    //opens new window.
                                    wndMain.Show();
                                }));

                                //close this screen.
                                this.Close();
                            }
                            else
                            {
                                Views.clGlobal.Ponumber = retunbyrow.PONumber;
                                _mponumner.mPOnumberRMA1(Views.clGlobal.Ponumber);

                                if (Views.clGlobal.IsAlreadySaved)
                                {
                                    this.Dispatcher.Invoke(new Action(() =>
                                    {
                                        WindowThread.start();
                                        //Create new instance of window.
                                        wndPONumber wndMain = new wndPONumber();
                                        mRMAAudit.logthis(_mUser.UserInfo.UserID.ToString(), "Valid_RGANumber_Scan", DateTime.UtcNow.ToString(), _mReturn.EnteredNumber);
                                        //opens new window.
                                        wndMain.Show();
                                    }));

                                    //close this screen.
                                    this.Close();
                                }
                            }
                        }
                        else
                        {
                            mRMAAudit.logthis(_mUser.UserInfo.UserID.ToString(), eActionType.InvalidRMANumberScanned__00.ToString(), DateTime.UtcNow.ToString(), TempRMANumber);
                            ErrorMsg("Invalid Number. Please check the number. :" + txtScan.Text, Color.FromRgb(185, 84, 0));
                            txtScan.Text = "";
                        }
                    }
                }
                else
                {
                    txtScan.Text = "";
                }
            }
        }
Example #10
0
 private void DisposeWebViewWindow(TimeSpan timeout)
 {
     this.webViewWindowThread?.Dispose(timeout);
     this.webViewWindowThread = null;
 }