WebBrowser文件浏览为什么单独创建新文件夹?

时间:2017-04-12 14:00:05

标签: c# winforms visual-studio webbrowser-control

本程序我一直在努力工作,除非文件夹名称包含任何符号,如“#”或“&”或者任何其他符号,当我打开已经存在的文件夹时,它将创建一个全新的文件夹,其后面有%和一些数字。但是,如果我删除符号就可以了。Photo Of The Folders 我不知道为什么会这样做。当我打开一个文件夹时,它将读取带有属性的文本文件,并将其显示在文本框中,但如果它有符号,它甚至不会这样做。但是,如果我删除符号而不更改属性,则属性显示符号,这样就不是问题了。如果有人知道为什么这样做或需要更多信息,请告诉我。

谢谢

    //
    //START UP PROCCESS
    //

    private void JobViewer_Load(object sender, EventArgs e)
    {


        timer1.Start(); //CLOCK
        int BrowserVer, RegVal;

        // get the installed IE version
        using (WebBrowser Wb = new WebBrowser())
            BrowserVer = Wb.Version.Major;

        // set the appropriate IE version
        if (BrowserVer >= 11)
            RegVal = 11001;
        else if (BrowserVer == 10)
            RegVal = 10001;
        else if (BrowserVer == 9)
            RegVal = 9999;
        else if (BrowserVer == 8)
            RegVal = 8888;
        else
            RegVal = 7000;

        // set the actual key
        RegistryKey Key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", true);
        Key.SetValue(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".exe", RegVal, RegistryValueKind.DWord);
        Key.Close();

        contextMenuStrip1.Renderer = new ToolStripProfessionalRenderer(new ColorTable());

    }
    //
    //OPEN PERSON'S FILE LOCATION
    //
    private void FLoc1_Click(object sender, EventArgs e)
    {

        DisplayJobs.Navigate(@"F:\Internal Jobs\Jobs\Chad");

    }
    private void FLoc2_Click(object sender, EventArgs e)
    {

        DisplayJobs.Navigate(@"F:\Internal Jobs\Jobs\Dan");
    }
    private void FLoc3_Click(object sender, EventArgs e)
    {

        DisplayJobs.Navigate(@"F:\Internal Jobs\Jobs\Erv");
    }
    private void FLoc4_Click(object sender, EventArgs e)
    {

        DisplayJobs.Navigate(@"F:\Internal Jobs\Jobs\Jacob");
    }
    private void FLoc5_Click(object sender, EventArgs e)
    {

        DisplayJobs.Navigate(@"F:\Internal Jobs\Jobs\Nate");
    }
    private void FLoc6_Click(object sender, EventArgs e)
    {

        DisplayJobs.Navigate(@"F:\Internal Jobs\Jobs\Miller");

    }
    private void FLoc7_Click(object sender, EventArgs e)
    {

        DisplayJobs.Navigate(@"F:\Internal Jobs\Jobs\Terry");

    }
    private void FLoc8_Click(object sender, EventArgs e)
    {

        DisplayJobs.Navigate(@"F:\Internal Jobs\Jobs\Kelley");
    }
    private void FLoc9_Click(object sender, EventArgs e)
    {

        DisplayJobs.Navigate(@"F:\Internal Jobs\Jobs\Jenny");
    }
private void DisplayJobs_DocumentCompleted(object sender, 
WebBrowserDocumentCompletedEventArgs e)
    {
        JobPath.Text = DisplayJobs.Url.ToString();


    }
    private void JobPath_TextChanged(object sender, EventArgs e)
    {

        textBox1.Text = JobPath.Text.Remove(0, 8);


        FilesMade();



        try
        {
            lblContact.Text = File.ReadAllText((@textBox1.Text + 
@"\Properties\Contact.txt"));
            lblJobName.Text = File.ReadAllText(@textBox1.Text + 
@"\Properties\JobName.txt");
            lblBidDate.Text = File.ReadAllText(@textBox1.Text + 
@"\Properties\BidDate.txt");
            lblEngineer.Text = File.ReadAllText(@textBox1.Text + 
@"\Properties\Engineer.txt");
            lblTakeOff.Text = File.ReadAllText(@textBox1.Text + 
@"\Properties\TakeOff.txt");
            lblReceived.Text = File.ReadAllText(@textBox1.Text + 
@"\Properties\Received.txt");
            lblVendor.Text = File.ReadAllText(@textBox1.Text + 
@"\Properties\Vendor.txt");
            //Specific Person Notes
            lblJDNotes.Text = File.ReadAllText(@textBox1.Text + 
@"\Properties\Notes\JDNotes.txt");
            lblNotes.Text = File.ReadAllText(@textBox1.Text + @"\Properties\Notes\GNotes.txt");
            ChadNotes.Text = File.ReadAllText(@textBox1.Text + @"\Properties\Notes\CNotes.txt");
            DanNotes.Text = File.ReadAllText(@textBox1.Text + @"\Properties\Notes\DNotes.txt");
            ErvNotes.Text = File.ReadAllText(@textBox1.Text + @"\Properties\Notes\ENotes.txt");
            NateNotes.Text = File.ReadAllText(@textBox1.Text + @"\Properties\Notes\NNotes.txt");
            TerryMNotes.Text = File.ReadAllText(@textBox1.Text + @"\Properties\Notes\TMNotes.txt");
            TerrySNotes.Text = File.ReadAllText(@textBox1.Text + @"\Properties\Notes\TSNotes.txt");
            KelleyNotes.Text = File.ReadAllText(@textBox1.Text + @"\Properties\Notes\KNotes.txt");
            JenNotes.Text = File.ReadAllText(@textBox1.Text + @"\Properties\Notes\JenNotes.txt");
            lblPriorApp.Text = File.ReadAllText(@textBox1.Text + @"\Properties\PriorApp.txt");

            lblProject.Text = File.ReadAllText(@textBox1.Text + @"\Properties\Project.txt");
            lblLocation.Text = File.ReadAllText(@textBox1.Text + @"\Properties\Location.txt");
        }
        catch
        { }

        //Converts The Bid Date To Long Date
        try
        {


            DateTime convertedtime = DateTime.Parse(lblBidDate.Text);
            JobName.Text = lblJobName.Text;


            JobLocation.Text = lblLocation.Text;

            JobBidDate.Text = convertedtime.ToLongDateString();
        }
        catch { }

        if (Directory.Exists(@textBox1.Text + @"\Archive"))
        {
            JobName.Text = "";
            JobLocation.Text = "";
            JobBidDate.Text = "";
        }
    }
    private void JLCont_char(object sender, EventArgs e)
    {

    }
    private void textBox1_TextChanged(object sender, EventArgs e)
    {
        // if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " 
- " + lblJobName.Text))
        //     btnEdit.Enabled = false;
        if (Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " 
+ lblJobName.Text))
            NewJob.Enabled = true;
        if (Directory.Exists(@textBox1.Text + "\\6-Emails"))
            NewJob.Enabled = true;
        if (Directory.Exists(@textBox1.Text + "\\6-Emails"))
            btnEdit.Enabled = true;

    }

    //
    //CREATE A NEW JOB
    //
    private wbNewJob wbNwJob = new wbNewJob();
    private void NewJob_Click(object sender, EventArgs e)
    {
        try
        {
            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + 
" - " + lblJobName.Text))
                Directory.CreateDirectory(@textBox1.Text + "\\" + 
lblBidDate.Text + " - " + lblJobName.Text);



            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\0-Submittals"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\0-Submittals");
            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\0-Submittals" + "\\Properties"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\0-Submittals" + "\\Properties");
            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\0-Submittals" + "\\Properties\\Notes"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\0-Submittals" + "\\Properties\\Notes");

            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\1-Pricing"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\1-Pricing");
            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\1-Pricing" + "\\Properties"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\1-Pricing" + "\\Properties");
            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\1-Pricing" + "\\Properties\\Notes"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\1-Pricing" + "\\Properties\\Notes");

            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\2-Take Off"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\2-Take Off");
            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\2-Take Off" + "\\Properties"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\2-Take Off" + "\\Properties");
            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\2-Take Off" + "\\Properties\\Notes"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\2-Take Off" + "\\Properties\\Notes");

            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\3-Files"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\3-Files");
            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\\3-Files" + "\\Properties"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\\3-Files" + "\\Properties");
            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\\3-Files" + "\\Properties\\Notes"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\\3-Files" + "\\Properties\\Notes");

            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\4-Plans"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\4-Plans");
            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\\4-Plans" + "\\Properties"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\\4-Plans" + "\\Properties");
            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\\4-Plans" + "\\Properties\\Notes"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\\4-Plans" + "\\Properties\\Notes");

            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\5-Specs"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\5-Specs");
            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\\5-Specs" + "\\Properties"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\\5-Specs" + "\\Properties");
            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\\5-Specs" + "\\Properties\\Notes"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\\5-Specs" + "\\Properties\\Notes");

            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\6-Emails"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\6-Emails");
            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\\6-Emails" + "\\Properties"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\\6-Emails" + "\\Properties");
            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\\6-Emails" + "\\Properties\\Notes"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\\6-Emails" + "\\Properties\\Notes");

            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\Properties"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + "\\Properties");
            if (!Directory.Exists(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\Properties\Notes"))
                Directory.CreateDirectory(@textBox1.Text + "\\" + lblBidDate.Text + " - " + lblJobName.Text + @"\Properties\Notes");
        }
        catch
        { }
        try
        {
            PriceAllInOnePricingCreate();
            ExcelTakeOffCreate();
            CapsPricingCreate();
            WriteToPropertiesNJ();
            WriteToEmailsNJ();
            WriteToFilesNJ();
            WriteToPlansNJ();
            WriteToPricingNJ();
            WriteToTakeOffNJ();
            WriteToSubmittals();
            WriteToSpecsNJ();
        }
        catch { }





        try
        {
            wbNwJob.Show();

            wbNwJob.lblContact.Text = lblContact.Text;
            wbNwJob.lblJobName.Text = lblJobName.Text;
            wbNwJob.lblLocation.Text = lblLocation.Text;
            wbNwJob.lblBidDate.Text = lblBidDate.Text;
            wbNwJob.lblEngineer.Text = lblEngineer.Text;
            wbNwJob.lblPriorApp.Text = lblPriorApp.Text;
            wbNwJob.lblTakeOff.Text = lblTakeOff.Text;
            wbNwJob.lblProject.Text = lblProject.Text;
        }
        catch { }


    }
    //
    //EDIT AN EXISTING JOB
    //
    private void btnEdit_Click_1(object sender, EventArgs e)
    {



        try
        {
            WriteToPropertiesED();
            WriteToEmailsED();
            WriteToFilesED();
            WriteToPlansED();
            WriteToPricingED();
            WriteToTakeOffED();
            WriteToSubmittalsED();
            WriteToSpecsED();

        }
        finally { MessageBox.Show("The Job Has Been Saved"); }

    }

0 个答案:

没有答案