コード例 #1
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            loadUI();
            this.axFramerControl1.Visible = false;
            string[] dl     = FtpHelper.FTPGetDetailList(p.FtpIP, p.FtpID, p.FtpPassword, p.FtpFolder, FtpHelper.FileType.Directorys);
            int      allppt = 0;

            if (dl != null)
            {
                foreach (string item in dl)
                {
                    TreeNode node = new TreeNode(item);
                    treePPTList.Nodes.Add(node);
                    treePPTList.SelectedNode = node;
                    string[] childdl = FtpHelper.FTPGetDetailList(p.FtpIP, p.FtpID, p.FtpPassword, p.FtpFolder + @"\" + item, FtpHelper.FileType.Files);

                    if (childdl != null)
                    {
                        foreach (string fs in childdl)
                        {
                            allppt += 1;
                            treePPTList.SelectedNode.Nodes.Add(fs);
                        }
                    }
                }

                treePPTList.ExpandAll();
            }

            if (p.CurrentUsr.permission == p.PermissionKey.administrtor)
            {
                if (dl != null)
                {
                    txtInfo.Text = "Welcom," + p.CurrentUsr.usrid + ",網絡上共計存有" + dl.Length + "類課程,共計" + allppt + "門(個)資料,你是管理員,可以點擊Upload上傳資料";
                }
                else
                {
                    txtInfo.Text = "Welcom," + p.CurrentUsr.usrid + ",網絡上無課程,你是管理員,可以點擊Upload上傳資料";
                }
                //btnUpload.Enabled = true;
            }
            else
            {
                if (dl != null)
                {
                    txtInfo.Text = "Welcom," + p.CurrentUsr.usrid + ",網絡上共計存有" + dl.Length + "類課程,共計" + allppt + "門(個)資料,你不是管理員,無法上傳更新資料,請聯繫管理員";
                }
                else
                {
                    txtInfo.Text = "Welcom," + p.CurrentUsr.usrid + ",網絡上無課程,你不是管理員,無法上傳更新資料,請聯繫管理員";
                }
                // btnUpload.Enabled = false;
            }
        }
コード例 #2
0
        private void treePPTList_AfterSelect(object sender, TreeViewEventArgs e)
        {
            string   ftpparentfolder = string.Empty;
            TreeNode selNode         = treePPTList.SelectedNode;

            if (selNode == null)
            {
                //防止空引用
                return;
            }
            if (selNode.Parent != null)
            {
                //为有父亲节点的,
                TreeNode parentNode = selNode.Parent;//得到父亲节点

                // MessageBox.Show (parentNode.Text);
                ftpparentfolder = p.FtpFolder + @"\" + parentNode.Text;

                if (selNode.Nodes.Count == 0)
                {
                    //为没有子节点,即选中的节点为叶子节点
                    // MessageBox.Show(selNode.Text);
                    //grbPPT.Visible = true;

                    string destfile = p.PPTFolder + @"\" + selNode.Text;


                    if (!File.Exists(destfile))
                    {
                        FtpHelper.FTPDownloadFile(p.FtpIP, p.FtpID, p.FtpPassword, p.PPTFolder, selNode.Text, ftpparentfolder + @"\" + selNode.Text);
                        System.IO.FileInfo fi = new FileInfo(p.PPTFolder + @"\" + selNode.Text);
                        fi.Attributes = FileAttributes.Hidden;
                    }

                    //MessageBox.Show(p.AppFolder + @"\" + selNode.Text);

                    // startTime =  DateTime.Now.AddSeconds(-1);
                    axFramerControl1.Open(p.PPTFolder + @"\" + selNode.Text);

                    //grbPPT.Focus();
                    //axFramerControl1.Focus();
                    //SendMessage(grbPPT.Handle , WM_KEYDOWN, VK_F5, 0);
                    //SendMessage(grbPPT.Handle, WM_KEYUP , VK_F5, 0);
                    //SendMessage(axFramerControl1.Handle, WM_KEYDOWN, VK_F5, 0);
                    //SendMessage(axFramerControl1.Handle, WM_KEYUP, VK_F5, 0);
                }
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: Edward125/LearningSystem
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            Process instance = RunningInstance();

            if (instance != null)
            {
                HandleRunningInstance(instance);
                Environment.Exit(0);
            }



            int n = 0;

            if (InternetGetConnectedState(out n, 0))
            {
                //  MessageBox.Show("yes");
            }
            else
            {
                MessageBox.Show("Your pc may not connect network,pls check and retry", "Network Invaild", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                System.Threading.Thread.Sleep(1000);
                // SplashForm.CloseSplash();
                Environment.Exit(0);
            }



            if (!p.checkFolder())
            {
                MessageBox.Show("Create app folder fail,program will exit.", "Create Folder Fail", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                System.Threading.Thread.Sleep(1000);
                // SplashForm.CloseSplash();
                Environment.Exit(0);
            }

            if (!File.Exists(@".\IrisSkin4.dll"))
            {
                if (!downloadIrisSkin4())
                {
                    System.Threading.Thread.Sleep(1000);
                    // SplashForm.CloseSplash();
                    Environment.Exit(0);
                }
            }

            if (!File.Exists(@".\System.Data.SQLite.dll"))
            {
                if (!downloadSqliteDll())
                {
                    System.Threading.Thread.Sleep(1000);
                    //SplashForm.CloseSplash();
                    Environment.Exit(0);
                }
            }

            if (!File.Exists(@".\SQLite.Interop.dll"))
            {
                if (!downloadSqliteInterop())
                {
                    System.Threading.Thread.Sleep(1000);
                    // SplashForm.CloseSplash();
                    Environment.Exit(0);
                }
            }


            if (!File.Exists(@".\dsoframer.ocx"))
            {
                if (!downloadDSOFramer())
                {
                    System.Threading.Thread.Sleep(1000);
                    // SplashForm.CloseSplash();
                    Environment.Exit(0);
                }
            }



            if (!File.Exists(p.AppFolder + @"\MacOS.ssk"))
            {
                if (!downloadSkin())
                {
                    System.Threading.Thread.Sleep(1000);
                    //SplashForm.CloseSplash();
                    Environment.Exit(0);
                }
            }

            //if (!p.checkDB(p.dbFile))
            //{
            //    System.Threading.Thread.Sleep(1000);
            //    //SplashForm.CloseSplash();
            //    Environment.Exit(0);
            //}

            if (!File.Exists(p.iniFilePath))
            {
                p.createIniFile(p.iniFilePath);
            }
            p.readIniValue(p.iniFilePath);
            {
                System.Threading.Thread.Sleep(1000);
                // Environment.Exit(0);
            }


            if (!RegControl())
            {
                System.Threading.Thread.Sleep(1000);
                //SplashForm.CloseSplash();
                Environment.Exit(0);
            }


#if DEBUG
            if (!p.checkDB(p.dbFile))
            {
                System.Threading.Thread.Sleep(1000);
                //SplashForm.CloseSplash();
                Environment.Exit(0);
            }

            string sql = "REPLACE INTO " + p.DBTable.d_usrlist.ToString() +
                         "(" + p.DBKeyValue.usrid.ToString() + "," + p.DBKeyValue.usrpwd.ToString() + "," + p.DBKeyValue.permission.ToString() +
                         ") VALUES ('D0805G260','D0805G260','" + p.PermissionKey.administrtor.ToString() + "')";

            p.insertDB(sql);

            Application.Run(new frmMain());
            return;
#else
            bool dbinftp = false;

            if (!File.Exists(p.dbFile))
            {
                string[] _f = FtpHelper.FTPGetFileList(p.FtpIP, p.FtpID, p.FtpPassword, p.FtpFolder);

                foreach (var item in _f)
                {
                    if (item == "DB.sqlite")
                    {
                        dbinftp = true;
                        break;
                    }
                }

                if (dbinftp)
                {
                    FtpHelper.FTPDownloadFile(p.FtpIP, p.FtpID, p.FtpPassword, p.AppFolder, "DB.sqlite", p.FtpFolder + @"\DB.sqlite");
                }

                string dblocal = p.AppFolder + @"\" + "DB.sqlite";
                if (File.Exists(dblocal))
                {
                    FileInfo fi = new FileInfo(dblocal);
                    fi.Attributes = FileAttributes.Hidden;
                }
            }
#endif


            System.Threading.Thread.Sleep(1000);
            Application.Run(new frmLogin());
        }