示例#1
0
 private void HandleEsc(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Escape)
     {
         MainW.Close();
     }
 }
示例#2
0
        private static void getView(object o, MainW mainW, out Type type)
        {
            RoutedEventArgs e     = o as RoutedEventArgs;
            int             index = mainW.menuImagePanel.Children.IndexOf(e.Source as Button);

            type = null;
            switch (index)
            {
            case 0:
                type = typeof(AttendanceMainV).Assembly.GetType("Attendance.Views.AttendanceMainV");
                break;

            case 1:
                type = typeof(ConsultMainV).Assembly.GetType("Consult.Views.ConsultMainV");
                break;

            case 2:
                type = typeof(BusinessLogMainV).Assembly.GetType("BusinessLog.Views.BusinessLogMainV");
                break;

            default:
                type = typeof(SettingsMainV).Assembly.GetType("Settings.Views.SettingsMainV");
                break;
            }
        }
示例#3
0
        /// <summary>
        /// 设置背景图
        /// </summary>
        /// <param name="enname"></param>
        public void SetBackImage(string enname)
        {
            var path = Picture.HeroOriginalPath(enname);

            if (!File.Exists(path))
            {
                path = Soft.LogoIcoPath;
            }
            MainW.ReLoadImageBmp(path);
        }
示例#4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            MainW.Hide();
            loginW.ShowDialog();

            if (LoginOK == true)
            {
                MainW.Show();
                Username = SocSecNb; //Visning af brugernavn på hovedmenu
            }
            if (LoginOK == false)
            {
                MainW.Close();
            }
            DataContext = this;
        }
示例#5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.Hide();

            loginW.ShowDialog();

            cpr_CB.Text = "Find CPR";


            if (LoginOK == true)
            {
                MainW.Show();
            }
            if (LoginOK == false)
            {
                MainW.Close();
            }
        }
示例#6
0
        private void ExecuteShowMainViews(object o)
        {
            MainW mainW = ViewManager.GetValue(typeof(MainW)) as MainW;
            Type  type;

            getView(o, mainW, out type);
            ViewBase mainV = ViewManager.GetValue(type) as ViewBase;

            if (((ViewModelBase)mainV.DataContext).IsGoodInit)
            {
                //현재 화면일 경우
                if (this.viewStack.Last != null && this.viewStack.Last.Value.Equals(mainV))
                {
                    MessageBoxResult messageBoxResult = MessageBox.Show("현재 창을 닫으시겠습니까?\n저장하지 않은 정보는 사라집니다.", "경고",
                                                                        MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No);

                    if (messageBoxResult.Equals(MessageBoxResult.Yes))
                    {
                        this.MenuColor[mainV.MenuIndex] = UNACTIVE_COLOR;

                        mainW.mainStage.Children.Remove(mainV);
                        this.viewStack.RemoveLast();
                        ViewManager.RemoveValue(type);
                        ViewModelManager.RemoveValue(mainV.DataContext.GetType());

                        if (this.viewStack.Last != null)
                        {
                            ViewBase oldView = this.viewStack.Last.Value;

                            this.MenuColor[oldView.MenuIndex] = CURRENT_ACTIVE_COLOR;
                            oldView.Visibility = Visibility.Visible;
                        }
                    }
                }
                //과거 화면일 경우
                else if (this.viewStack.Contains(mainV))
                {
                    ViewBase oldView = this.viewStack.Last.Value;

                    this.MenuColor[oldView.MenuIndex] = ACTIVE_COLOR;
                    oldView.Visibility = Visibility.Collapsed;

                    this.viewStack.Remove(mainV);
                    this.viewStack.AddLast(mainV);

                    this.MenuColor[mainV.MenuIndex] = CURRENT_ACTIVE_COLOR;
                    mainV.Visibility = Visibility.Collapsed;
                }
                //처음 켜는 경우
                else
                {
                    if (this.viewStack.Last != null)
                    {
                        ViewBase oldView = this.viewStack.Last.Value;

                        this.MenuColor[oldView.MenuIndex] = ACTIVE_COLOR;
                        oldView.Visibility = Visibility.Collapsed;
                    }
                    this.viewStack.AddLast(mainV);

                    mainW.mainStage.Children.Add(mainV);
                    this.MenuColor[mainV.MenuIndex] = CURRENT_ACTIVE_COLOR;
                }

                if (this.viewStack.Last != null)
                {
                    ViewBase newView = this.viewStack.Last.Value;
                    this.Title = newView.Title;
                    DoubleAnimation show = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(1));
                    Storyboard.SetTarget(show, newView);
                    Storyboard.SetTargetProperty(show, new PropertyPath(UserControl.OpacityProperty));
                    Storyboard sb = new Storyboard();
                    sb.Children.Add(show);
                    sb.Begin();
                }
                else
                {
                    this.Title = DEFAULT_TITLE;
                }
            }
        }
示例#7
0
 private void LogoutButton_Click(object sender, RoutedEventArgs e)
 {
     loginW.Show();
     MainW.Hide();
 }
示例#8
0
        /// <summary>
        /// 设置背景图
        /// </summary>
        /// <param name="skin"></param>
        public void SetBackImage(Skin skin)
        {
            var path = Picture.SkinOriginalPath(skin);

            MainW.ReLoadImageBmp(path);
        }