public LoaderSaverProvider(FileViewType fileViewType,
                            Action <ProviderCallbackType, string> providerCallback, object model = null, uint[,,] display = null)
 {
     _fileViewType     = fileViewType;
     _model            = model;
     _display          = display;
     _providerCallback = providerCallback;
 }
        private async void CallbackAction(bool result, FileViewType fileViewType, string resultPath)
        {
            Result     = result;
            ResultPath = resultPath;
            if (!result)
            {
                Busy         = false;
                ResultString = "Operation canceled";
                _providerCallback.Invoke(ProviderCallbackType.End, string.Empty);
                return;
            }

            await Task.Run(LoadSave);
        }
Example #3
0
        public void AddFileView(FileViewType type, string filePath)
        {
            if (!File.Exists(filePath))
            {
                EventDispatcher.Raise(new UserNotificationEvent("File '{0}' not found".FormatWith(filePath), UserNotificationType.Warning));
                return;
            }

            var tab = new FileViewTab(filePath, new ClassDiagramView(filePath));

            tab.ContextMenu = new ContextMenu(new []{new MenuItem("Close", (sender, args) =>
                {
                    MenuItem item = (MenuItem) sender;
                    FileViewTab t = (FileViewTab) item.Tag;
                    RemoveFileView(t);
                }){Tag = tab}
            });

            this.FileViewTabs.TabPages.Add(tab);
            this.FileViewTabs.SelectedTab = tab;
        }
Example #4
0
        public void Set(FileViewType fileViewType, Action <bool, FileViewType, string> resultAction)
        {
            _resultAction = resultAction;
            _viewType     = fileViewType;
            switch (fileViewType)
            {
            case FileViewType.LoadFlame:
            case FileViewType.LoadRender:
                OkButtonText = "load";
                break;

            case FileViewType.SaveFlame:
            case FileViewType.SaveRender:
                OkButtonText = "save";
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(fileViewType), fileViewType, null);
            }
            GetFiles();
        }
Example #5
0
        public void AddFileView(FileViewType type, string filePath)
        {
            if (!File.Exists(filePath))
            {
                EventDispatcher.Raise(new UserNotificationEvent("File '{0}' not found".FormatWith(filePath), UserNotificationType.Warning));
                return;
            }

            var tab = new FileViewTab(filePath, new ClassDiagramView(filePath));

            tab.ContextMenu = new ContextMenu(new [] { new MenuItem("Close", (sender, args) =>
                {
                    MenuItem item = (MenuItem)sender;
                    FileViewTab t = (FileViewTab)item.Tag;
                    RemoveFileView(t);
                })
                                                       {
                                                           Tag = tab
                                                       } });

            this.FileViewTabs.TabPages.Add(tab);
            this.FileViewTabs.SelectedTab = tab;
        }
Example #6
0
 public void AddFileView(FileViewType type, string filePath)
 {
 }
 public void AddFileView(FileViewType type, string filePath)
 {
     
 }
        private void SetResource(string filePath, bool loadWithTypeNone = false)
        {
            var typeInfo = FileType.GetFileViewType(filePath);

            if (loadWithTypeNone)
            {
                typeInfo.Type = FileViewType.None;
            }
            if (lastViewType != typeInfo.Type || MyGrid.Children[0] is HelloControl)
            {
                lastViewType = typeInfo.Type;
                MyGrid.Children.Clear();
            }
            else if (MyGrid.Children.Count == 1)
            {
                (MyGrid.Children[0] as FileControl).OnFileChanged((filePath, typeInfo.Ext));
                return;
            }
            FileControl fc;

            switch (typeInfo.Type)
            {
            case FileViewType.Image:
                fc = new ImageControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.Code:
            case FileViewType.Txt:
                fc = new TextControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.Music:
                fc = new MusicControl();
                GlobalNotify.OnResizeMode(false);
                break;

            case FileViewType.Video:
                fc = new VideoControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.Pdf:
                fc = new PdfControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.Excel:
                fc = new ExcelControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.Word:
                fc = new WordControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.PowerPoint:
                fc = new PowerPointControl();
                GlobalNotify.OnResizeMode(true);
                break;

            default:
                fc = new CommonControl();
                GlobalNotify.OnResizeMode(false);
                break;
            }
            if (fc != null)
            {
                LoadFile(fc, filePath, typeInfo.Ext);
            }
        }