Exemple #1
0
        //回调
        private void Child_PassDataBetweenForm(object sender, PassDataWinFormEventArgs e)
        {
            SiginButton.Content = e.Account;

            ConfigAppSettings.SetValue("Account", e.Account);
            ConfigAppSettings.SetValue("Password", e.Key);
            //ObservableCollection<Authority> authorities = Post.GetAuthorityList();
            //PageMain.thelist = getFileName(Post.GetAuthorityList());

            isSigined = true;

            if (MainWindow.isSigined)
            {
                //ObservableCollection<Authority> mainlist = getFileName(Post.GetAuthorityList());
                ObservableCollection <Authority> mainlist = Post.GetAuthorityList();
                foreach (Authority item in mainlist)
                {
                    item.File_Name = item.File_Path.Split('/').Last();
                    //item.File_Path.Replace("/", "\\");
                    item.File_Path = item.File_Path.Replace("/", "\\");
                    PageMain.thelist.Add(item);
                }

                Console.WriteLine(DesktopApplication.Properties.Settings.Default.firstLogin);
            }

            //PageHistory.refreshchart();

            //Console.WriteLine("thelist.COUNT" + PageMain.thelist.Count + "");
        }
Exemple #2
0
        public MainWindow(string arg)
        {
            MyKeys.MYDIRECTORY = AppDomain.CurrentDomain.BaseDirectory;
            InitializeComponent();
            init();
            icon();
            wsl = WindowState;
            HomeButton.Focus();
            requestMethod();

            MyKeys.FILE_PATH = arg;

            if (System.Windows.MessageBox.Show("确定要添加该项管理吗?",
                                               "e-lock", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                if (!ConfigAppSettings.GetValue("Account").Equals("") && !ConfigAppSettings.GetValue("Password").Equals(""))
                {
                    Post.HttpLogin(ConfigAppSettings.GetValue("Account"), ConfigAppSettings.GetValue("Password"));
                    SiginButton.Content = ConfigAppSettings.GetValue("Account");
                    isSigined           = true;

                    if (MainWindow.isSigined)
                    {
                        if (!MyKeys.FILE_PATH.Equals(""))
                        {
                            if (Post.SendAuthority(MyKeys.FILE_PATH.Replace("\\", "/"), "1"))
                            {
                                //ObservableCollection<Authority> mainlist = getFileName(Post.GetAuthorityList());
                                ObservableCollection <Authority> mainlist = Post.GetAuthorityList();
                                foreach (Authority item in mainlist)
                                {
                                    //item.File_Path.Replace("/", "\\");
                                    item.File_Path = item.File_Path.Replace("/", "\\");
                                    PageMain.thelist.Add(item);
                                }
                            }
                        }
                    }
                }
                else
                {
                    System.Windows.MessageBox.Show("您还未登录!",
                                                   "e-lock", MessageBoxButton.OK);
                }
            }
            else
            {
                System.Windows.Application.Current.Shutdown();
            }
        }