Example #1
0
        private void InitInfo(TabStatus status)
        {
            Status = status;

            if (File.Exists(FileName))
            {
                Title = Path.GetFileName(FileName);

                using (var fs = new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    MD5Code = FileHelper.ComputeMD5(fs);

                    fs.Position = 0;
                    using (var sr = new StreamReader(fs, Encoding.UTF8))
                    {
                        FileContent = sr.ReadToEnd();
                    }
                }
            }
            else
            {
                Title       = FileName;
                FileContent = (status & TabStatus.Inner) == TabStatus.Inner ? Application.Current.Resources["HelpContentTemplate"] as string : Application.Current.Resources["FileContentTemplate"] as string;
            }

            CopyOrOpenPathCommand.RaiseCanExecuteChanged();
        }
Example #2
0
        public void SaveToFile()
        {
            using (var fs = new FileStream(FileName, FileMode.Create, FileAccess.ReadWrite, FileShare.Read))
            {
                using (var sw = new StreamWriter(fs, Encoding.UTF8))
                {
                    sw.Write(FileContent);
                }
            }

            MD5Code = FileHelper.ComputeMD5(FileName);
            Status &= ~(TabStatus.NoSave);
        }
Example #3
0
        public TabViewModel(string fileName, TabStatus status, Action <TabViewModel, bool> closeAction)
        {
            FileName     = fileName;
            _closeAction = closeAction;
            _guid        = Guid.NewGuid().ToString();

            _eventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>();
            _appCommands     = ServiceLocator.Current.GetInstance <IApplicationCommands>();
            _dialogService   = ServiceLocator.Current.GetInstance <IDialogService>();

            InitEvent();
            InitCommand();

            InitInfo(status);
        }
        private static DocuSignTabStatus ParseTab(TabStatus dstab)
        {
            var tab = new DocuSignTabStatus();

            tab.DocumentId = dstab.DocumentID;
            tab.Name       = dstab.TabName;
            tab.TabLabel   = dstab.TabLabel;
            string tabType = Enum.GetName(typeof(TabTypeCode), dstab.TabType);

            if (tabType == "Custom")
            {
                tabType = Enum.GetName(typeof(CustomTabType), dstab.CustomTabType);
            }
            tab.TabType = tabType;
            tab.Value   = dstab.TabValue;
            return(tab);
        }
Example #5
0
        private void OnTextChanged(EditorInfo info)
        {
            if (!IsSelected)
            {
                return;
            }
            ;

            if (info.IsModified || !File.Exists(FileName))
            {
                Status |= TabStatus.NoSave;
            }
            else
            {
                Status &= ~(TabStatus.NoSave);
            }
        }
Example #6
0
        private void OnTextChanged(EditorInfo info)
        {
            if (info.Guid != _guid)
            {
                return;
            }

            if (info.IsModified || !File.Exists(FileName))
            {
                Status |= TabStatus.NoSave;
            }
            else
            {
                Status &= ~(TabStatus.NoSave);
            }

            SaveCommand.RaiseCanExecuteChanged();
        }
Example #7
0
        public TabViewModel(string fileName, TabStatus status, Action <TabViewModel, bool> closeAction)
        {
            FileName     = fileName;
            _closeAction = closeAction;
            _guid        = Guid.NewGuid().ToString();

            _container = ServiceLocator.Current.GetInstance <IContainerExtension>();
            if (_container != null)
            {
                _appData         = _container.Resolve <AppData>();
                _eventAggregator = _container.Resolve <IEventAggregator>();
                _appCommands     = _container.Resolve <IApplicationCommands>();
                _dialogService   = _container.Resolve <IDialogService>();
                _regionManager   = _container.Resolve <IRegionManager>();
            }

            InitEvent();
            InitCommand();

            InitInfo(status);
        }
Example #8
0
 protected bool Equals(TabStatus other)
 {
     return(Id == other.Id && string.Equals(Description, other.Description));
 }