internal void MainUI_RollingObjectCreated()
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke(new MainUI_RollingObjectCreatedHandler(this.MainUI_RollingObjectCreated));
     }
     else
     {
         APPLICATION_MAINFORM with_1 = this;
         //Add What you want to do here.
         //启用工具栏 ------ 同步滚动
         with_1.TlStrpBtn_Roll.Enabled = true;
     }
 }
 /// <summary>
 /// 在指定的时间间隔内触发闹钟事件
 /// </summary>
 /// <param name="myObject"></param>
 /// <param name="myEventArgs"></param>
 /// <remarks></remarks>
 public void TimerEventProcessor(object myObject, EventArgs myEventArgs)
 {
     if (alarmCounter == 2)
     {
         APPLICATION_MAINFORM with_1 = this;
         with_1.ProgressBar1.Visible = false;
         with_1.StatusLabel1.Visible = false;
         myTimer.Stop();
         alarmCounter = 1;
     }
     else
     {
         alarmCounter++;
     }
 }
            /// <summary>
            /// 隐藏主程序界面中的进度条与进度信息
            /// </summary>
            /// <param name="state">要显示在进度信息标签中的文本</param>
            /// <remarks></remarks>
            public void HideProgress(string state)
            {
                APPLICATION_MAINFORM with_1 = this;

                if (with_1.InvokeRequired)
                {
                    //非UI线程,再次封送该方法到UI线程
                    this.BeginInvoke(new HideProgressHandler(this.HideProgress), state);
                }
                else
                {
                    //UI线程,进度更新
                    //主程序界面的进度条的UI显示
                    this.ProgressBar1.Value   = 100;
                    this.ProgressBar1.Visible = false;
                    this.StatusLabel1.Text    = state;
                    myTimer.Interval          = 500;
                    myTimer.Start();
                }
            }
            public void ShowProgressBar_Continue(int Value)
            {
                APPLICATION_MAINFORM with_1 = this;

                if (with_1.InvokeRequired)
                {
                    //非UI线程,再次封送该方法到UI线程
                    this.BeginInvoke(new ShowProgressBar_ContinueHander[this.ShowProgressBar_Continue], new[] { Value });
                }
                else
                {
                    //UI线程,进度更新
                    //主程序界面的进度条的UI显示

                    with_1.StatusLabel1.Text    = "Please Wait...";
                    with_1.StatusLabel1.Visible = true;

                    with_1.ProgressBar1.Visible = true;
                    with_1.ProgressBar1.Style   = ProgressBarStyle.Continuous;
                    //获取或设置进度块在进度栏内滚动所用的时间段,以毫秒为单位,其值越小,图形滚动得越快。
                    //只对于Style属性为Marquee的ProgressBar控件有效。
                    with_1.ProgressBar1.Value = Value;
                }
            }
            /// <summary>
            /// 在主程序界面上显示进度条与进度信息
            /// </summary>
            /// <remarks></remarks>
            public void ShowProgressBar_Marquee()
            {
                APPLICATION_MAINFORM with_1 = this;

                if (with_1.InvokeRequired)
                {
                    //非UI线程,再次封送该方法到UI线程
                    this.BeginInvoke(new ShowProgressBar_MarqueeHandler(this.ShowProgressBar_Marquee));
                }
                else
                {
                    //UI线程,进度更新
                    //主程序界面的进度条的UI显示

                    with_1.StatusLabel1.Text    = "Please Wait...";
                    with_1.StatusLabel1.Visible = true;

                    with_1.ProgressBar1.Visible = true;
                    with_1.ProgressBar1.Style   = ProgressBarStyle.Marquee;
                    //获取或设置进度块在进度栏内滚动所用的时间段,以毫秒为单位,其值越小,图形滚动得越快。
                    //只对于Style属性为Marquee的ProgressBar控件有效。
                    with_1.ProgressBar1.MarqueeAnimationSpeed = 30;
                }
            }
 /// <summary>
 /// 设置项目文档打开后的主程序的UI界面
 /// </summary>
 /// <remarks></remarks>
 internal void MainUI_ProjectOpened()
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke(new MainUI_ProjectOpenedHandler(this.MainUI_ProjectOpened));
     }
     else
     {
         APPLICATION_MAINFORM with_1 = this;
         //Add What you want to do here.
         //启用菜单项 ------ 文件
         with_1.MenuItem_EditProject.Enabled   = true;
         with_1.MenuItem_SaveProject.Enabled   = true;
         with_1.MenuItem_SaveAsProject.Enabled = true;
         with_1.MenuItemExport.Enabled         = true;
         //启用菜单项 ------ 编辑
         with_1.MenuItemDrawingPoints.Enabled = true;
         //启用菜单项 ------ 绘图
         with_1.MenuItemSectionalView.Enabled = true;
         with_1.MenuItemPlanView.Enabled      = true;
         //启用工具栏 ------ 同步滚动
         with_1.TlStrpBtn_Roll.Enabled = true;
     }
 }
Ejemplo n.º 7
0
 private static void MUniqueInstanceFormClosed(object sender, FormClosedEventArgs e)
 {
     m_uniqueInstance = null;
 }
Ejemplo n.º 8
0
            /// <summary>
            /// 退出主程序
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            /// <remarks>
            /// 这里用FormClosing事件来控制主程序的退出,而不用Dispose事件来控制,
            /// 是为了解决其子窗口在各自的FormClosing事件中只是将其进行隐藏并取消了默认的关闭操作,
            /// 所以这里在主程序最先触发的FormClosing事件中就直接执行Me.Dispose()方法,这样就可以
            /// 跳过子窗口的FormClosing事件,而直接退出主程序了。
            /// </remarks>
            public void mainForm_FormClosing(object sender, FormClosingEventArgs e)
            {
                AmeDrawings AllDrawing = GlbApp.ExposeAllDrawings();

                if (AllDrawing.Count() > 0)
                {
                    DialogResult result = MessageBox.Show("还有图表未处理,是否要关闭所有绘图并退出程序", "tip",
                                                          MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question,
                                                          MessageBoxDefaultButton.Button3);
                    if (result == DialogResult.Yes) //关闭AME主程序,同时也关闭所有的绘图程序。
                    {
                        Hide();
                        //' --- 通过新的工作线程来执行绘图程序的关闭。
                        //Dim thd As New Thread(AddressOf Me.QuitDrawingApplications)
                        //With thd
                        //    .Name = "关闭所有绘图程序"
                        //    .Start(AllDrawing)
                        //    thd.Join()
                        //End With
                        // ---
                        //通过Main Thread来执行绘图程序的关闭。
                        QuitDrawingApplications(AllDrawing);
                    } //不关闭图表,但关闭程序
                    else if (result == DialogResult.No)
                    {
                    } //图表与程序都不关闭
                    else if (result == DialogResult.Cancel)
                    {
                        e.Cancel = true;
                        return;
                    }
                }
                // ---------------------- 先隐藏主界面,以达到更好的UI效果。
                Hide();
                //--------------------------- 断后工作
                try
                {
                    //关闭隐藏的Excel数据库中的所有工作簿
                    foreach (Workbook wkbk in GlbApp.ExcelApplication_DB.Workbooks)
                    {
                        wkbk.Close(false);
                    }
                    GlbApp.ExcelApplication_DB.Quit();
                    //这一步非常重要哟
                    GlbApp.ExcelApplication_DB = null;
                }
                catch (Exception)
                {
                    //有可能会出现数据库文件已经被关闭的情况
                }

                //保存主程序窗口关闭时的界面位置与大小
                APPLICATION_MAINFORM with_1    = this;
                mySettings_UI        mysetting = new mySettings_UI();

                mysetting.WindowLocation = with_1.Location;
                mysetting.WindowSize     = with_1.Size;
                mysetting.WindowState    = with_1.WindowState;
                mysetting.Save();

                //---------------------------
                //这里在主程序最先触发的FormClosing事件中就直接执行Me.Dispose()方法,
                //这样就可以跳过子窗口的FormClosing事件,而直接退出主程序了。
                Dispose();
            }
Ejemplo n.º 9
0
            /// <summary>
            /// 构造函数
            /// </summary>
            /// <remarks></remarks>
            public APPLICATION_MAINFORM()
            {
                // This call is required by the designer.
                InitializeComponent();

                //Added to support default instance behavour in C#
                if (m_uniqueInstance == null)
                {
                    m_uniqueInstance = this;
                }
                // Add any initialization after the InitializeComponent() call.
                //----------------------------
                GlbApp = new GlobalApplication();
                //为关键字段赋初始值()
                F_main_Form = this;
                //----------------------------
                MainUI_ProjectNotOpened();
                //获取与文件或文件夹路径有关的数据
                GetPath();
                //----------------------------
                //创建新窗口,窗口在创建时默认是不隐藏的。
                frmSectionView                      = new frmDrawElevation();
                frmSectionView.FormClosing         += frmSectionView.frmDrawSectionalView_FormClosing;
                frmSectionView.Disposed            += frmSectionView.frmDrawElevation_Disposed;
                frmMnt_Incline                      = new frmDrawing_Mnt_Incline();
                frmMnt_Incline.FormClosing         += frmMnt_Incline.frmDrawing_Mnt_Incline_FormClosing;
                frmMnt_Incline.Disposed            += frmMnt_Incline.frmDrawing_Mnt_Incline_Disposed;
                frmMnt_Incline.DataWorkbookChanged += frmMnt_Incline.frmDrawing_Mnt_Incline_DataWorkbookChanged;
                frmMnt_Incline.Activated           += frmMnt_Incline.frmDrawing_Mnt_Incline_Activated;
                frmMnt_Incline.Deactivate          += frmMnt_Incline.frmDrawing_Mnt_Incline_Deactivate;
                frmMnt_Others                      = new frmDrawing_Mnt_Others();
                frmMnt_Others.Load                += frmMnt_Others.frmDrawingMonitor_Load;
                frmMnt_Others.FormClosing         += frmMnt_Others.frmDrawing_Mnt_Others_FormClosing;
                frmMnt_Others.Disposed            += frmMnt_Others.frmDrawing_Mnt_Others_Disposed;
                frmMnt_Others.DataWorkbookChanged += frmMnt_Others.frmDrawing_Mnt_Incline_DataWorkbookChanged;
                frmMnt_Others.Activated           += frmMnt_Others.frmDrawing_Mnt_Incline_Activated;
                frmMnt_Others.Deactivate          += frmMnt_Others.frmDrawing_Mnt_Incline_Deactivate;
                frmRolling = new frmRolling();

                // ----------------------- 设置MDI窗体的背景
                foreach (Control C in Controls)
                {
                    if (string.Compare(C.GetType().ToString(), "System.Windows.Forms.MdiClient", true) == 0)
                    {
                        MdiClient MDIC = (MdiClient)C;
                        MDIC.BackgroundImage       = Resources.线条背景;
                        MDIC.BackgroundImageLayout = ImageLayout.Tile;
                        break;
                    }
                }
                // ----------------------- 设置主程序窗口启动时的状态
                APPLICATION_MAINFORM with_2     = this;
                mySettings_UI        mysettings = new mySettings_UI();
                FormWindowState      winState   = mysettings.WindowState;

                switch (winState)
                {
                case FormWindowState.Maximized:
                    with_2.WindowState = winState;
                    break;

                case FormWindowState.Minimized:
                    with_2.WindowState = FormWindowState.Normal;
                    break;

                case FormWindowState.Normal:
                    with_2.WindowState = winState;
                    with_2.Location    = mysettings.WindowLocation;
                    with_2.Size        = mysettings.WindowSize;
                    break;
                }
                //在新线程中进行程序的一些属性的初始值的设置
                Thread thd = new Thread(new ThreadStart(myDefaltSettings));

                thd.Name = "程序的一些属性的初始值的设置";
                thd.Start();
            }