コード例 #1
0
        internal virtual void PrepareVistaDialog(IFileDialog dialog)
        {
            dialog.SetDefaultExtension(this.DefaultExt);
            dialog.SetFileName(this.CriticalFileName);
            if (!string.IsNullOrEmpty(this.InitialDirectory))
            {
                IShellItem shellItemForPath = ShellUtil.GetShellItemForPath(this.InitialDirectory);
                if (shellItemForPath != null)
                {
                    dialog.SetDefaultFolder(shellItemForPath);
                    dialog.SetFolder(shellItemForPath);
                }
            }
            dialog.SetTitle(this.Title);
            FOS options = (FOS)((this.Options & 1063690) | 536870912 | 64);

            dialog.SetOptions(options);
            COMDLG_FILTERSPEC[] filterItems = FileDialog.GetFilterItems(this.Filter);
            if (filterItems.Length != 0)
            {
                dialog.SetFileTypes((uint)filterItems.Length, filterItems);
                dialog.SetFileTypeIndex((uint)this.FilterIndex);
            }
            IList <FileDialogCustomPlace> customPlaces = this.CustomPlaces;

            if (customPlaces != null && customPlaces.Count != 0)
            {
                foreach (FileDialogCustomPlace customPlace in customPlaces)
                {
                    IShellItem shellItem = FileDialog.ResolveCustomPlace(customPlace);
                    if (shellItem != null)
                    {
                        try
                        {
                            dialog.AddPlace(shellItem, FDAP.BOTTOM);
                        }
                        catch (ArgumentException)
                        {
                        }
                    }
                }
            }
        }
コード例 #2
0
        public void Calculate()
        {
            int index = 0;
            int check;

            try
            {
                //i = 1;
                dataGridViewMusking.Rows.Clear();
                //AssignValues();
                RainIntensityInput();
                ThetaU2 = ThetaU1;
                i       = 1;

                for (j = 0; j < n; j++)
                {
                    check = 1;
                    AssignValues();
                    //MessageBox.Show("Rain = " + RainInt[j] + "  j = " + j);
                    //dataGridViewMusking.Rows[index].Cells[0].Value = RainInt[j].ToString("0.00");
                    while (true)
                    {
                        do
                        {
                            //ThetaU2 = ThetaU2 + 1;

                            //Grad = (ThetaU2 + ThetaU1 - 2 * ThetaR) / (2 * ThetaS - 2 * ThetaR) * ks / 100;

                            // h2 = (h1 * (L_ThetaDr_DelT - velocity) * 0.5 + Grad * L) / ((L_ThetaDr_DelT + velocity) * 0.5);

                            //Vu = L * D - 0.25 * h1 * L - 0.25 * h2 * L;


                            c1 = h1 * 0.5 * (L_ThetaDr_DelT - velocity);
                            c2 = 0.5 * (L_ThetaDr_DelT + velocity);

                            p1 = ThetaU1 - 2 * ThetaR;
                            p2 = 2 * (ThetaS - ThetaR);

                            q1 = L * D - 0.25 * h1 * L;

                            b1 = (q1 - L * 0.25 * ((c1 + (ThetaU2 + p1) * ks * 0.01 * L / p2) / c2));
                            fx = b1 * (ThetaU2 - ThetaU1) / del_t - (RainInt[j] / 1000 - (ThetaU2 + p1) * ks * 0.01 / p2) * L;

                            f_dash_x = b1 / del_t + (ThetaU2 - ThetaU1) / del_t * (-0.25 * L * ks * 0.01 * L / (p2 * c2)) + ks * 0.01 * L / p2;

                            ThetaU22 = ThetaU2 - fx / f_dash_x;

                            ThetaU2 = ThetaU22;

                            //b1 = (q1 - L * 0.25 * ((c1 + (ThetaU2 + p1) * ks * 0.01 * L / p2) / c2));
                            //fx = b1 * (ThetaU2 - ThetaU1) / del_t - (r - (ThetaU2 + p1) * ks * 0.01 / p2) * L;

                            error = Math.Abs(fx);

                            //MessageBox.Show("#" + i + "\n ThetaU2 = "+ThetaU2 + "\n error = " + error + "\n p1,p2 = " + p1 + " " + p2);
                        } while (error > err);

                        TxtMsg.Text = TxtMsg.Text + "iteration #" + i + " completed \r\n";

                        Grad = (ThetaU2 + ThetaU1 - 2 * ThetaR) / (2 * ThetaS - 2 * ThetaR) * ks / 100;

                        h2 = (h1 * (L_ThetaDr_DelT - velocity) * 0.5 + Grad * L) / ((L_ThetaDr_DelT + velocity) * 0.5);

                        Vu = L * D - 0.25 * h1 * L - 0.25 * h2 * L;

                        available_shear = c_dash + (Gamma * z - GammaW * h2) * Math.Cos(beta * Math.PI / 180) * Math.Cos(beta * Math.PI / 180) * Math.Tan(phi * Math.PI / 180);

                        required_shear = Gamma * z * Math.Sin(beta * Math.PI / 180) * Math.Cos(beta * Math.PI / 180);

                        FOS = available_shear / required_shear;

                        if (FOS >= 1)
                        {
                            FS = FOS;
                        }

                        dataGridViewMusking.Rows.Add();

                        if (check == 1)
                        {
                            dataGridViewMusking.Rows[index].Cells[0].Value = RainInt[j].ToString("0.00");
                            check = 0;
                        }

                        dataGridViewMusking.Rows[index].Cells[1].Value = del_t.ToString("0.00");
                        dataGridViewMusking.Rows[index].Cells[2].Value = ThetaU1.ToString("0.000");
                        dataGridViewMusking.Rows[index].Cells[3].Value = ThetaU2.ToString("0.00000");
                        dataGridViewMusking.Rows[index].Cells[4].Value = Grad;
                        dataGridViewMusking.Rows[index].Cells[5].Value = h1.ToString();
                        dataGridViewMusking.Rows[index].Cells[6].Value = h2;
                        dataGridViewMusking.Rows[index].Cells[7].Value = Vu;
                        dataGridViewMusking.Rows[index].Cells[8].Value = error.ToString("0.000000");
                        dataGridViewMusking.Rows[index].Cells[9].Value = FOS.ToString("0.0000");

                        i++;

                        if (FOS < 1)
                        {
                            //TxtTime.Text = (del_t - dt).ToString();
                            dataGridView1.Rows[j].Cells[2].Value = (del_t - dt).ToString("0.0000");
                            Time[j]        = (del_t - dt);
                            XRainAmount[j] = RainInt[j] * (del_t - dt);
                            dataGridView1.Rows[j].Cells[3].Value = (RainInt[j] * (del_t - dt)).ToString("0.00");
                            dataGridView1.Rows[j].Cells[4].Value = FS.ToString("0.0000");
                            break;
                        }

                        ThetaU1 = ThetaU2;
                        h1      = h2;
                        del_t   = del_t + dt;
                        index   = index + 1;
                    }
                }

                DrawGraph();
                TxtMsg.Text = TxtMsg.Text + "...............END...................  \r\n";
            }
            catch
            {
            }
        }