public void Initialize(Cockpit cockpit)
        {
            ActiveCockpit = cockpit;
            cockpit.Name  = "fileSaveCockpit";

            float fHUDRadius = this.HUDRadius;

            cockpit.DefaultCursorDepth = fHUDRadius;

            ListView = new IconFilesystemPanel()
            {
                IconSize   = this.IconSize,
                FolderPath = InitialPath
            };
            if (ValidExtensions != null)
            {
                foreach (string s in ValidExtensions)
                {
                    ListView.Source.ValidExtensions.Add(s);
                }
            }
            ListView.Source.FilterInaccessibleFolders = true;
            ListView.Initialize(cockpit, fHUDRadius);

            add_text_entry_field(cockpit);

            // setup interactions
            cockpit.AddKeyHandler(new FileBrowserTextFieldKeyHandler(cockpit.Context, entryField)
            {
                OnReturn = () => { SaveFile(Path.GetFullPath(Path.Combine(ListView.FolderPath, entryField.Text))); }
            });
            cockpit.InputBehaviors.Add(new VRMouseUIBehavior(cockpit.Context)
            {
                Priority = 0
            });
            cockpit.InputBehaviors.Add(new VRGamepadUIBehavior(cockpit.Context)
            {
                Priority = 0
            });
            cockpit.InputBehaviors.Add(new VRSpatialDeviceUIBehavior(cockpit.Context)
            {
                Priority = 0
            });

            FolderListAdapter adapter = new FolderListAdapter()
            {
                OnFileClickedAction       = (s) => { entryField.Text = s; },
                OnFileDoubleClickedAction = (s) => SaveFile(s),
                OnListChanged             = (l) => { ListView = l; }
            };

            adapter.OnFolderChanged(ListView);
            cockpit.InputBehaviors.Add(new FolderScrollBehavior(adapter));

            cockpit.OverrideBehaviors.Add(new ScreenCaptureBehavior()
            {
                Priority       = 0,
                ScreenshotPath = Environment.GetEnvironmentVariable("homepath") + "\\DropBox\\ScreenShots\\"
            });
        }
        public void Initialize(Cockpit cockpit)
        {
            ActiveCockpit = cockpit;
            cockpit.Name  = "fileOpenCockpit";

            float fHUDRadius = this.HUDRadius;

            cockpit.DefaultCursorDepth = fHUDRadius;

            ListView = new IconFilesystemPanel()
            {
                IconSize   = this.IconSize,
                FolderPath = InitialPath
            };
            if (ValidExtensions != null)
            {
                foreach (string s in ValidExtensions)
                {
                    ListView.Source.ValidExtensions.Add(s);
                }
            }
            ListView.Source.FilterInaccessibleFolders = true;
            ListView.Initialize(cockpit, fHUDRadius);

            add_text_entry_field(cockpit);

            // setup interactions
            cockpit.AddKeyHandler(new FileBrowserTextFieldKeyHandler(cockpit.Context, entryField)
            {
                OnReturn = () => { LoadFile(Path.GetFullPath(Path.Combine(ListView.FolderPath, entryField.Text))); }
            });
            cockpit.InputBehaviors.Add(new VRMouseUIBehavior(cockpit.Context)
            {
                Priority = 0
            });
            cockpit.InputBehaviors.Add(new VRGamepadUIBehavior(cockpit.Context)
            {
                Priority = 0
            });
            cockpit.InputBehaviors.Add(new VRSpatialDeviceUIBehavior(cockpit.Context)
            {
                Priority = 0
            });

            // IconFileSystemPanel objects basically replace themselves in the scene when
            //  the user changes directories. So, we need a way to transfer event handlers
            //  between these objects. This is what FolderListAdapter does.
            FolderListAdapter adapter = new FolderListAdapter()
            {
                OnFileClickedAction       = (s) => { entryField.Text = s; },
                OnFileDoubleClickedAction = (s) => LoadFile(s),
                OnListChanged             = (l) => { ListView = l; }
            };

            adapter.OnFolderChanged(ListView);
            cockpit.InputBehaviors.Add(new FolderScrollBehavior(adapter));


            //cockpit.OverrideBehaviors.Add(new ScreenCaptureBehavior() { Priority = 0,
            //    ScreenshotPath = Environment.GetEnvironmentVariable("homepath") + "\\DropBox\\ScreenShots\\" });
            cockpit.OverrideBehaviors.Add(new FBEncoderCaptureBehavior()
            {
                Priority       = 0,
                ScreenshotPath = Environment.GetEnvironmentVariable("homepath") + "\\DropBox\\ScreenShots\\"
            });
        }
Exemple #3
0
 public FolderScrollBehavior(FolderListAdapter adapter)
 {
     this.adapter = adapter;
 }