コード例 #1
0
ファイル: Form1.cs プロジェクト: trannhan/AMS
 private void menuItemOpen_Click(object sender, System.EventArgs e)
 {
     DrawingListProject dp = new DrawingListProject();
     string CurPath = dp.Open();
     if(dp.ProjectName != null)
     {
         for(int i=0; i< this.tabControlDrawingList.Controls.Count; i++)
         {
             if(this.tabControlDrawingList.Controls[i].Text == dp.ProjectName)
             {
                 this.tabControlDrawingList.SelectedTab = (TabPage)this.tabControlDrawingList.Controls[i];
                 return;
             }
         }
         ChangeSavePath(dp,CurPath);
         AddTabPage(dp);
     }
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: trannhan/AMS
 public void SaveProject(bool bSaveAs)
 {
     if(this.tabControlDrawingList.SelectedTab != null)
     {
         //Save project
         ListForm.ListForm[] DrawingListWindow = new ListForm.ListForm[this.tabControlDrawingList.SelectedTab.Controls.Count];
         for(int i=0;i<this.tabControlDrawingList.SelectedTab.Controls.Count;i++)
         {
             DrawingListWindow[i] = (ListForm.ListForm)this.tabControlDrawingList.SelectedTab.Controls[i];
         }
         DrawingListProject dp = new DrawingListProject(ProjectType[this.tabControlDrawingList.SelectedIndex],
             this.tabControlDrawingList.SelectedTab.Text,
             this.ProjSavePath[this.tabControlDrawingList.SelectedIndex],
             this.tabControlDrawingList.SelectedTab.Controls.Count,
             DrawingListWindow);
         dp.Save(bSaveAs);
     }
 }
コード例 #3
0
ファイル: Form1.cs プロジェクト: trannhan/AMS
        private void ChangeSavePath(DrawingListProject dp, string CurPath)
        {
            int index = CurPath.LastIndexOf("\\");
            int count = CurPath.Length - index;
            CurPath = CurPath.Remove(index,count);

            dp.ProjSavePath = CurPath;
            for(int i=0; i<dp.WindowCount;i++)
            {
                dp.DrawingListWindows[i].SavePath = CurPath + "\\" + sDrawingList + "\\" + dp.DrawingListWindows[i].Caption.Text;
                /*
                if(dp.ProjectType == AMS)
                {
                    for(int j=0; j< dp.DrawingListWindows[i].FileList.Count;j++)
                    {
                        dp.DrawingListWindows[i].FileList.AMSFiles[j].FilePath = dp.DrawingListWindows[i].SavePath + "\\" + dp.DrawingListWindows[i].FileList.AMSFiles[j].FileName + ".dwg";
                    }
                }
                */
            }
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: trannhan/AMS
        public void AddTabPage(DrawingListProject dp)
        {
            //
            // tabPage Drawing List
            //
            TabPage newTab = new TabPage();
            newTab.Location = new System.Drawing.Point(4, 4);
            newTab.Name = "DrawingList" + ((int)(tabControlDrawingList.TabCount+1)).ToString();
            newTab.AutoScroll = true;
            newTab.TabIndex = tabControlDrawingList.TabCount;
            newTab.Text = "Drawing List " + ((int)(tabControlDrawingList.TabCount+1)).ToString();

            this.ProjSavePath[this.tabControlDrawingList.Controls.Count] = dp.ProjSavePath;
            this.ProjectType[this.tabControlDrawingList.Controls.Count] = dp.ProjectType;

            //Set Name
            newTab.Text = dp.ProjectName;

            //Add TabPage
            this.tabControlDrawingList.Controls.Add(newTab);
            this.menuItemNewChild.Enabled = true;

            //Add child Drawing List Window
            this.tabControlDrawingList.SelectedTab = newTab;
            for(int i=0; i<dp.WindowCount;i++)
            {
                //dp.DrawingListWindows[i].Name = "A" + this.tabControlDrawingList.SelectedTab.Controls.Count.ToString();
                dp.DrawingListWindows[i].Enter += new System.EventHandler(this.Control_Enter);
                dp.DrawingListWindows[i].ContextMenu = this.contextMenuWindow;
                newTab.Controls.Add(dp.DrawingListWindows[i]);
            }
            ResizeChildWindows(this.tabControlDrawingList.SelectedTab);
        }