Ejemplo n.º 1
0
        private void getRecentWorkspace()
        {
            IList<RecentFile> lRecentProjects = MainClass.Settings.RecentFiles.GetWorkspace();
            int no =0;
            foreach(RecentFile rf in lRecentProjects){

                WebButton lb = new WebButton();
                lb.Label = System.IO.Path.GetFileName(rf.DisplayName);
                lb.HoverMessage =rf.DisplayName;
                //lb.Description=" ";
                lb.WidthRequest = 150;
                string fileName = rf.FileName;
                lb.Clicked+= delegate(object sender, EventArgs e) {
                    Workspace.Workspace workspace = Workspace.Workspace.OpenWorkspace(fileName);
                    if (workspace != null)
                        MainClass.MainWindow.ReloadWorkspace(workspace,false,true);
                };
                tblAction.Attach(lb,(uint)2,(uint)3,(uint)(no+2),(uint)(no+3),AttachOptions.Fill,AttachOptions.Shrink,0,0);
                no++;
                if (no>=2) break;
            }
            if(lRecentProjects.Count>2){
                DropDownButton.ComboItemSet otherSample = new DropDownButton.ComboItemSet ();

                DropDownButton ddbSample = new DropDownButton();
                ddbSample.Relief = ReliefStyle.None;
                ddbSample.HeightRequest = 25;
                ddbSample.MarkupFormat = "<span  foreground=\"#697077\"><b>{0}</b></span>";
                ddbSample.WidthRequest = 150;
                ddbSample.SetItemSet(otherSample);
                for (int i = 3;i<lRecentProjects.Count;i++){
                    DropDownButton.ComboItem addComboItem = new DropDownButton.ComboItem(System.IO.Path.GetFileName(lRecentProjects[i].DisplayName)
                                                                                       ,lRecentProjects[i].FileName);
                    otherSample.Add(addComboItem);
                }
                ddbSample.ActiveText="More...";
                ddbSample.Changed+= delegate(object sender, DropDownButton.ChangedEventArgs e) {
                    if(e.Item !=null){
                        string worksPath = (string)e.Item;
                        Workspace.Workspace workspace = Workspace.Workspace.OpenWorkspace(worksPath);
                        if (workspace != null)
                            MainClass.MainWindow.ReloadWorkspace(workspace,true,true);
                    }
                };
                tblAction.Attach(ddbSample,(uint)2,(uint)3,(uint)(no+2),(uint)(no+3),AttachOptions.Fill,AttachOptions.Fill,0,0);
            }
        }