Пример #1
0
        public MainWindow()
        {
            InitializeComponent();

            try
            {
                // Set TimeValue tự động chốt tồn kho

                log4net.Config.XmlConfigurator.Configure();

                this.Visibility = System.Windows.Visibility.Hidden;
                Check_Connection _Check = new Check_Connection();
                if (_Check.ShowDialog() != true)
                {
                    //neu tra ve khong hop le thi dong ung dung
                    ForceClose = true;
                    this.Close();
                }

                AddHandler(Keyboard.PreviewKeyDownEvent, (KeyEventHandler)HandleKeyDownEvent);

                this.Visibility = System.Windows.Visibility.Visible;

                TimerSP.Interval  = new TimeSpan(0, 0, 1);
                TimerSP.IsEnabled = true;
                TimerSP.Tick     += new EventHandler(TimerSP_Tick);

                username.Content = CommonData.c_Urser_Info.User_Name;
            }
            catch
            {
            }
        }
Пример #2
0
        private void UserLogin()
        {
            try
            {
                this.Visibility = System.Windows.Visibility.Hidden;
                Check_Connection _Check = new Check_Connection();
                if (_Check.ShowDialog() != true)
                {
                    //neu tra ve khong hop le thi dong ung dung
                    ForceClose = true;
                    this.Close();
                }

                this.Visibility = System.Windows.Visibility.Visible;

                #region Lay quyen User Login o day!

                GetAllRibbonButtonFunction();

                foreach (User_FunctionsInfo quyen in DBMemory.c_arrQuyen)
                {
                    try
                    {
                        if (quyen.name != null && hashRibbonButtonFunction.ContainsKey(quyen.name))
                        {
                            RibbonButton _rb = (RibbonButton)hashRibbonButtonFunction[quyen.name];
                            _rb.OverridesDefaultStyle = false; //hien lai ribbon button

                            //hien nhung ribbon tab chua button ()
                            RibbonTab _rt = Common.Ultil.FindLogicalParent <RibbonTab>(_rb);
                            if (_rt != null)
                            {
                                _rt.Visibility = System.Windows.Visibility.Visible;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        string str = ex.ToString();
                    }
                }

                #endregion

                username.Content = CommonData.c_Urser_Info.User_Name;

                this.Focus();
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
            }
        }