コード例 #1
0
        private void bbi_ItemClick(object sender, ItemClickEventArgs e)
        {
            var paths = FileGroup.SplitFilePaths((string)e.Item.Tag);

            if (paths.Length > 0)
            {
                DialogResult r;
                if (groupFilesControl.CurrentFileGroupControl != null)
                {
                    r = groupFilesControl.CurrentFileGroupControl.DoSaveFiles(
                        SaveOptions.OnlyIfModified |
                        SaveOptions.AskConfirm);
                }
                else
                {
                    r = DialogResult.OK;
                }

                if (r == DialogResult.OK)
                {
                    addMruFilesFile(FileGroup.JoinFilePaths(paths));
                    //_mruFilesMenu.SetFirstFile( e.Number );

                    groupFilesControl.DoLoadFiles(
                        FileGroup.CheckCreate(
                            ProjectFilesControl.Project,
                            paths),
                        ProjectFilesControl.Project);
                }
            }
            else
            {
                removeMruFilesFile(FileGroup.JoinFilePaths(paths));
                //_mruFilesMenu.RemoveFile( e.Number );
            }
            UpdateUI();
        }
コード例 #2
0
        private void loadMruFileFiles()
        {
            barSubRecentFiles.ItemLinks.Clear();

            var files = coreLoadMruFileFiles();

            if (files.Length <= 0)
            {
                barSubRecentFiles.Visibility = BarItemVisibility.Never;
                barSubRecentFiles.Enabled    = false;
            }
            else
            {
                barSubRecentFiles.Visibility = BarItemVisibility.Always;
                barSubRecentFiles.Enabled    = true;

                var index = 0;
                foreach (var file in files)
                {
                    var splitted = FileGroup.SplitFilePaths(file);

                    if (splitted.Length > 0)
                    {
                        var bbi =
                            new BarButtonItem
                        {
                            Caption =
                                string.Format(
                                    @"{0} {1}",
                                    index + 1,
                                    ZlpPathHelper.GetFileNameFromFilePath(splitted[0])),
                            //Description =
                            //    ZrePathHelper.ShortenPathName(
                            //        splitted[0],
                            //        MruMaxCharSize),
                            SuperTip        = createToolTip(splitted[0]),
                            Tag             = file,
                            Enabled         = true,
                            Visibility      = BarItemVisibility.Always,
                            LargeImageIndex = 41,
                        };

                        bbi.ItemClick += bbi_ItemClick;

                        barSubRecentFiles.ItemLinks.Add(bbi);

                        index++;
                    }
                }

                // --

                if (barSubRecentFiles.ItemLinks.Count > 0)
                {
                    var bbi =
                        new BarButtonItem
                    {
                        Caption =
                            Resources.SR_MainFormNew_loadMruFileFiles_ClearRecentFilesList,
                        Description = Resources.SR_MainFormNew_loadMruFileProjects_RemovesAllItemsFromTheListAbove,
                        Enabled     = true,
                        Visibility  = BarItemVisibility.Always
                    };

                    bbi.ItemClick +=
                        delegate
                    {
                        coreStoreMruFileFiles(new string[] { });
                        UpdateUI();
                        loadMruFileFiles();
                    };

                    barSubRecentFiles.ItemLinks.Add(bbi, true);
                }
            }
        }