} //How List will be sorted (user select at the View) public List <Doctor> Doctors() //sorted doctors { List <Doctor> DocSortedList = new List <Doctor>(); if (HowToSort == "Alphabetically") //sorted doctors by alphabetically { var sortAlph = DocList.OrderBy(i => i.User.Lastname).ThenBy(i => i.User.Name).ThenBy(i => i.User.Patronymic); DocSortedList = sortAlph.ToList(); } else if (HowToSort == "Number_of_patients") //sorted doctors by number of patients { var sortByNumber = DocList.OrderBy(i => i.NumberOfPatients); DocSortedList = sortByNumber.Reverse().ToList(); } else if (HowToSort == "Catagory") //sorted doctors by catagory { var sortByNumber = DocList.OrderBy(i => i.Category == "Higher").ThenBy(x => x.Category == "Second").ThenBy(y => y.Category == "First"); DocSortedList = sortByNumber.Reverse().ToList(); } else { DocSortedList = CreateListOf.MedicalStuff(); } return(DocSortedList); }
private void ImportTxt_Executed(object arg) { var model = new ImportTextViewModel(arg, _storageContextViewModel); DocList.Add(model); model.Start(); }
public void Test_DocList_3() { using (var app = new AzosApplication(null, BASE_CONF)) { var doc = new DocList(); doc.IMin = 5000; doc.DList = new List <object> { new DocCompositeField { D1 = new DocDirectField { S1 = "zzzzkey" }, D2 = new DocDirectField { S1 = "key" } } }; var ve = doc.Validate(app); Aver.IsNotNull(ve); if (ve is FieldValidationException fve) { Console.WriteLine(fve.Message); Aver.IsTrue(fve.Message.Contains("list")); } else { Aver.Fail("Not a FVExcp"); } ((DocCompositeField)doc.DList[0]).D1.S1 = "key"; ve = doc.Validate(app); Aver.IsNull(ve); } }
/// <summary> /// Импортировать текст из буфера обмена /// </summary> /// <param name="arg"></param> private void ImportClipboardTxt_Executed(object arg) { var model = new ImportTextViewModel(typeof(Clipboard), _storageContextViewModel); DocList.Add(model); model.Start(); }
public TagModelList() { Help = new LocalizedText("TagModelListHelp"); Items = new DocList <TagModel>(); FileName = new DocObj <string>(); Version = new TagVersionEnum(); Version.Help = new LocalizedText("TagModelListVersionHelp"); Version.IsEnabled = false; HasSelection = new DocObj <bool>(); multiVersionAdapter.LinkedToHook = false; multiVersionAdapter.RegardListTransaction = true; multiVersionAdapter.PropertyProvider = TagModel.VersionItemProvider; multiVersionAdapter.PropertyProviderSelected = TagModel.SelectedVersionItemProvider; multiVersionAdapter.Items = Items; multiVersionAdapter.DocEnum = Version; Version.Hook = VersionEnumHook; selectionAdapterHook.LinkedToHook = true; selectionAdapterHook.RegardListTransaction = true; selectionAdapterHook.PropertyChangedEvent += OnSelectionChangedHook; selectionAdapterHook.PropertyProvider = TagModel.SelectionItemProvider; selectionAdapterHook.Items = Items; selectionAdapter.LinkedToHook = false; selectionAdapter.RegardListTransaction = true; selectionAdapter.PropertyChangedEvent += OnSelectionChanged; selectionAdapter.PropertyProvider = TagModel.SelectionItemProvider; selectionAdapter.Items = Items; }
public void Test_DocList_2() { using (var app = new AzosApplication(null, BASE_CONF)) { var doc = new DocList(); doc.IMin = 5;//below acceptable doc.DList = new List <object> { new DocCompositeField { D1 = new DocDirectField { S1 = "key" }, D2 = new DocDirectField { S1 = "key" } } }; var ve = doc.Validate(app); Aver.IsNotNull(ve); if (ve is FieldValidationException fve) { fve.Message.See(); Aver.IsTrue(fve.Message.Contains("min")); } else { Aver.Fail(Constants.ERR_NOT_FVEXCP); } doc.IMin = 5000; ve = doc.Validate(app); Aver.IsNull(ve); } }
private async void ImportXml_Executed(object arg) { var file = PlatformManager.Instance.ShowImportXmlUI(); if (file == null) { return; } try { using (var stream = File.OpenRead(file)) { var doc = await SIDocument.LoadXml(stream); var docViewModel = new QDocument(doc, _storageContextViewModel) { Path = "", Changed = true, FileName = Path.GetFileNameWithoutExtension(file) }; LoadMediaFromFolder(docViewModel, Path.GetDirectoryName(file)); DocList.Add(docViewModel); } } catch (Exception exc) { ShowError(exc); } }
private void EditorForm_Load(object sender, EventArgs e) { SetLanguage(); Text = LangCtrl.GetString("dlg_MemoEditor", "Memo Editor"); LoadVoices(); if (DocList.Equals(null)) { DocList = new List <DOCData>(); } if (DocList.Count > 0) { int num = 0; mnu_LoadFile.Visible = false; mnu_Save.Visible = false; try { using (RPM_DataFile rpmDataFile = new RPM_DataFile()) { foreach (DOCData doc in DocList) { FileMemo memo = rpmDataFile.GetMemo(doc.RecId); if (PageBreak) { textControl1.Append(memo.Memo, StringStreamType.RichTextFormat, AppendSettings.StartWithNewSection); } else { textControl1.Append(memo.Memo, StringStreamType.RichTextFormat, AppendSettings.None); } IsReadOnly = true; ++num; } textControl1.EditMode = EditMode.ReadOnly; } } catch (Exception ex) { string message = ex.Message; } } else { try { if (!RTF.Equals(string.Empty)) { textControl1.Load(RTF, StringStreamType.RichTextFormat); } } catch { } } string stringData; textControl1.Save(out stringData, StringStreamType.RichTextFormat); Hash = stringData.GetHashCode(); textControl1.BackgroundStyle = BackgroundStyle.ColorScheme; textControl1.BorderStyle = TXTextControl.BorderStyle.None; }
public void AppendDocItem(DocDto docDto) { if (DocList == null) { DocList = new ObservableCollection <DocDto>(); } docDto.Parent = this; DocList.Add(docDto); }
public void SetVersion(TagVersionEnum v) { DocList <PreferencesItem> list = CurrentFrameIds.ItemT <DocList <PreferencesItem> >(); list.Clear(); foreach (var item in FrameIds[v.Value]) { list.Add(item); } }
public MultiTagModel() { Help = new LocalizedText("MultiTagModelHelp"); IsFixed = new DocObj <bool>(false); IsFixed.Help = new LocalizedText("MultiTagModelIsFixedHelp"); TagModels = new DocList <TagModel>(true); MultiTagModelItems = new DocList <MultiTagModelItem>(); adapter.MultiTagModel = this; IsFixed.PropertyChanged += UpdateIsFixed; }
public TagModel() { File = new DocObj <string>(); IsSelected = new DocObj <bool>(true); IsPlaying = new DocObj <bool>(false); Version = new TagVersionEnum(); Bitrate = new DocObj <int>(-1); Items = new DocList <TagModelItem>(); createableFrames.Model = this; Items.CollectionChanged += new NotifyCollectionChangedEventHandler(OnItemsChanged); }
/// <summary> /// Sets up Document list properties and databinds the document list. /// </summary> protected override void OnLoad(System.EventArgs e) { base.OnLoad(e); if (!IsPostBack) { DocList.PageLinkProperty = PageLinkProperty; if (MaxCountProperty != null && CurrentPage[MaxCountProperty] != null) { DocList.MaxCount = (int)CurrentPage[MaxCountProperty]; } DocList.DataBind(); } }
public async void AutoSave() { foreach (var item in DocList.ToArray()) { try { await item.SaveIfNeeded(true); } catch (Exception exc) { ShowError(exc); } } }
private async void SaveAll_Executed(object arg) { foreach (var item in DocList.ToArray()) { try { await item.SaveIfNeeded(false); } catch (Exception exc) { ShowError(exc); } } }
public async Task <bool> DisposeRequest() { foreach (var doc in DocList.ToArray()) { await doc.Close.ExecuteAsync(null); if (DocList.Contains(doc)) // Закрытие отменено { return(false); } } return(true); }
private async Task Restore() { using (DataBaseHelper dbh = new DataBaseHelper()) { var res = await dbh.GetElements <Doc>(Tables.DocTable, Tables.DocFields); DocList.Clear(); foreach (var doc in res) { var edoc = await doc.FillChildModels(); DocList.Add(edoc); } } }
public void Test_DocList_4() { using (var app = new AzosApplication(null, BASE_CONF)) { var doc = new DocList(); doc.IMin = 1000; doc.DList = new List <object> { null, null, null, new DocCompositeField { D1 = new DocDirectField { S1 = "key" }, D2 = new DocDirectField { S1 = "key" } } }; Aver.IsNull(doc.Validate(app)); } }
private void ImportFromSIStore_Executed(object arg) { DocList.Add(new ImportSIStorageViewModel(_storageContextViewModel)); }
public Playlist() { IsPlayingUpdater = new PlayerModelIsPlayingUpdater(); Items = new DocList <TagModel>(); }
public PreferencesPreparse() : base( new LocalizedText("PreferencesPreparse"), new LocalizedText("PreferencesPreparseHelp")) { TextTrim = new PreferencesItem( new LocalizedText("PreferencesPreparseTextTrim"), new LocalizedText("PreferencesPreparseTextTrimHelp"), new DocObj <bool>(true)); TextBreakCamelCase = new PreferencesItem( new LocalizedText("PreferencesPreparseTextBreakCamelCase"), new LocalizedText("PreferencesPreparseTextBreakCamelCaseHelp"), new DocObj <bool>(true)); TextBreakUnderscores = new PreferencesItem( new LocalizedText("PreferencesPreparseTextBreakUnderscores"), new LocalizedText("PreferencesPreparseTextBreakUnderscoresHelp"), new DocObj <bool>(true)); TextFirstCharUpper = new PreferencesItem( new LocalizedText("PreferencesPreparseTextFirstCharUpper"), new LocalizedText("PreferencesPreparseTextFirstCharUpperHelp"), new DocObj <bool>(true)); WordList = new PreferencesItem( new LocalizedText("PreferencesPreparseWordList"), new LocalizedText("PreferencesPreparseWordListHelp"), new DocObj <string>(ID3.Preferences.WordsReadonly)); CreateTrackNumbers = new PreferencesItem( new LocalizedText("PreferencesPreparseCreateTrackNumbers"), new LocalizedText("PreferencesPreparseCreateTrackNumbersHelp"), new DocObj <bool>(false)); DropUnwantedFrames = new PreferencesItem( new LocalizedText("PreferencesPreparseDropUnwantedFrames"), new LocalizedText("PreferencesPreparseDropUnwantedFramesHelp"), new DocObj <bool>(false)); DropCodecs = new PreferencesItem( new LocalizedText("PreferencesPreparseDropCodecs"), new LocalizedText("PreferencesPreparseDropCodecsHelp"), new DocObj <bool>(true)); FrameIds = new DocList <DocList <PreferencesItem> >(); CurrentFrameIds = new PreferencesItem( new LocalizedText("PreferencesPreparseFramesToKeep"), new LocalizedText("PreferencesPreparseFramesToKeepHelp"), new DocList <PreferencesItem>(true)); AlbumToFilename = new PreferencesItem( new LocalizedText("PreferencesPreparseAlbumToFilename"), new LocalizedText("PreferencesPreparseAlbumToFilenameHelp"), new DocObj <bool>(false)); AlbumToDirectory = new PreferencesItem( new LocalizedText("PreferencesPreparseAlbumToDirectory"), new LocalizedText("PreferencesPreparseAlbumToDirectoryHelp"), new DocObj <bool>(false)); FrameIds.ReadOnly = true; foreach (ID3.Version v in ID3.Version.Versions) { DocList <PreferencesItem> list = new DocList <PreferencesItem>(); list.ReadOnly = true; TagDescription td = ID3.TagDescriptionMap.Instance[v]; IEnumerable <string> def = TagProcessorDropFrames.DefaultFrameIds(v); foreach (string frameId in td.FrameIds) { list.Add(new PreferencesItem( frameId, new Text(frameId + " " + td.DescriptionTextByID(frameId)), new LocalizedText("PreferencesPreparseFramesToKeepHelp"), new DocObj <bool>(def.Contains(frameId)))); } FrameIds.Add(list); } WordList.ItemT <DocObj <string> >().PropertyChanged += new PropertyChangedEventHandler(OnWordListChanged); }
/// <summary> /// Открытие существующего файла /// </summary> /// <param name="path">Имя файла</param> /// <param name="fileStream">Открытый для чтения файл</param> internal void OpenFile(string path, string search = null, string overridePath = null, Action onSuccess = null) { var savingPath = overridePath ?? path; Task <QDocument> loader() => Task.Run(() => { FileStream stream = null; try { stream = File.Open(path, FileMode.Open, FileAccess.ReadWrite); // Раньше было read = false // Но из-за этого при каждом открытии, даже если файл не изменялся, менялась дата его изменения var doc = SIDocument.Load(stream); var docViewModel = new QDocument(doc, _storageContextViewModel) { Path = savingPath, FileName = Path.GetFileNameWithoutExtension(savingPath) }; if (search != null) { docViewModel.SearchText = search; } if (overridePath != null) { docViewModel.OverridePath = overridePath; docViewModel.OriginalPath = path; docViewModel.Changed = true; } return(docViewModel); } catch (Exception exc) { if (stream != null) { stream.Dispose(); } if (exc is FileNotFoundException) { AppSettings.Default.History.Remove(path); } if (exc is UnauthorizedAccessException && (new FileInfo(path).Attributes & FileAttributes.ReadOnly) > 0) { throw new Exception(Resources.FileIsReadOnly); } throw exc; } }); DocList.Add(new DocumentLoaderViewModel(path, loader, () => { AppSettings.Default.History.Add(savingPath); onSuccess?.Invoke(); })); }
/// <summary> /// Новый /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void New_Executed(object sender, ExecutedRoutedEventArgs e) { DocList.Add(new NewViewModel(_storageContextViewModel)); }
void Item_Closed(WorkspaceViewModel doc) { doc.Dispose(); DocList.Remove(doc); }
void Item_NewDoc(WorkspaceViewModel doc) { DocList.Add(doc); }
private void About_Executed(object arg) { DocList.Add(new AboutViewModel()); }
private void Help_Executed(object sender, ExecutedRoutedEventArgs e) { DocList.Add(new HowToViewModel()); }
private void SetSettings_Executed(object arg) { DocList.Add(new SettingsViewModel()); }
private void SearchFolder_Executed(object arg) { DocList.Add(new SearchFolderViewModel(this)); }