//bool _ClickOnItem = false; private void FileNameList_PreviewMouseDown(object sender, MouseButtonEventArgs e) { if (_dragged != null) { return; } UIElement element = FileNameList.InputHitTest(e.GetPosition(FileNameList)) as UIElement; while (element != null) { if (element is ListBoxItem) { _dragged = (ListBoxItem)element; break; } element = VisualTreeHelper.GetParent(element) as UIElement; } if (e.ClickCount != 1) { return; } _dragStartPoint = e.GetPosition(e.Source as FrameworkElement); _isMouseDown = true; }
private void ShowGraphProperties() { if (FileNameList.Any()) { _graphRepository.ShowGraphDetails(FileNameList[SelectedIndexFileNames]); VertexesNumber = _graphRepository.VertexesNumber; EdgesNumber = _graphRepository.EdgesNumber; GraphSequence = _graphRepository.GraphSequence; GraphConnectivity = _graphRepository.GraphConnectivity; } }
void ReadDetail(FileNameList filesname) { // read the json files foreach (var filePath in filesname.FileNames) { //get content and read each file var xmlString = _dataContentReader.GetDataContent(filePath); //TO-DO //format/restructure the data i.e in custom structure horseDetails.AddRange(_xmlDataExtractor.ExtractHorseDetail(xmlString)); } }
public IEnumerable <HorseDetail> ReadHorseDetail(FileNameList filesname) { if (filesname == null) { return(null); } try { ReadDetail(filesname); } catch (Exception) { //shout // yell // log // } return(horseDetails); }
/// <summary> /// Records data in a text file /// </summary> /// <param name="append">'True' to append the file, 'False' to overwrite it</param> /// <param name="repo">Name of the repository - stats, history, menace</param> /// <param name="data">String to be appendedwritten in the repo</param> /// <returns></returns> public string Record(bool append, FileNameList repo, string data) { // get filename // Get confirmation for overwriting file if (!append) { bool confirmed = GetConfirmation($"Are you sure you overwrite \"{repo}\"?"); if (!confirmed) { return($"writing in \"{repo}\" cancelled"); } } string fullPath = FullPath(repo.ToString()); StreamWriter recorder = new StreamWriter(fullPath, append); string timeStamp = TimeStamp("something wicked this way comes"); recorder.WriteLine(timeStamp); recorder.WriteLine(data); recorder.Flush(); return("Done"); }
private void SaveButton_Click(object sender, EventArgs e) { this.model.Type = this.NameTextBox1.Text; this.model.Junle = this.NameTextBox2.Text; this.model.Writer = this.NameTextBox3.Text; this.model.Title = this.NameTextBox4.Text; this.model.No = this.NameTextBox5.Text; this.model.ReleaseDate = this.NameTextBox6.Text; this.model.SubTitle = this.NameTextBox7.Text; var value1 = this.CreateList(this.NameTextBox1.Items, this.model.Type); Settings.Default.NameText1 = value1; var value2 = this.CreateList(this.NameTextBox2.Items, this.model.Junle); Settings.Default.NameText2 = value2; var value3 = this.CreateList(this.NameTextBox3.Items, this.model.Writer); Settings.Default.NameText3 = value3; var value4 = this.CreateList(this.NameTextBox4.Items, this.model.Title); Settings.Default.NameText4 = value4; var value5 = this.CreateList(this.NameTextBox7.Items, this.model.SubTitle); Settings.Default.NameText7 = value5; Settings.Default.Save(); var fileNameList = new FileNameList(); fileNameList.Initialize(); fileNameList.ChangeFileName(this.model); var args = new SaveClickEventArgs(this.model.FilePath); this.SaveClick(args); }