Пример #1
0
        internal async void OpenFile()
        {
            if (selectedItem == null || selectedItem.Item < 0 || selectedItem.Item >= selectedItem.DataSource.Count)
            {
                return;
            }

            if (selectedItem.DataSource[selectedItem.Item].CanActivate)
            {
                selectedItem.DataSource[selectedItem.Item].Activate();
                ParentWindow.Dispose();
            }
            else
            {
                var region = SelectedItemRegion;
                if (string.IsNullOrEmpty(SelectedItemFileName))
                {
                    ParentWindow.Dispose();
                    return;
                }

                if (region.Length <= 0)
                {
                    if (Pattern.LineNumber == 0)
                    {
                        await IdeApp.Workbench.OpenDocument(SelectedItemFileName, project : null);
                    }
                    else
                    {
                        await IdeApp.Workbench.OpenDocument(SelectedItemFileName, null, Pattern.LineNumber, Pattern.HasColumn?Pattern.Column : 1);
                    }
                }
                else
                {
                    await IdeApp.Workbench.OpenDocument(new FileOpenInformation (SelectedItemFileName, null) {
                        Offset = region.Offset
                    });
                }
                ParentWindow.Dispose();
            }
        }