public GameForm() { InitializeComponent(); string[] dataIn = LoadFromFile.LoadFileToString("LastNames.txt"); foreach (string s in dataIn) { OutputText.AppendText(s + "\n"); } // game = linkedgame; }
static void Main(string[] args) { IRepository repo = new ContactsRepository(); ISearchEngine search = new SearchContacts(repo); SaveToFile saver = new SaveToFile(); LoadFromFile loader = new LoadFromFile(); ContactsController con = new ContactsController(repo, loader, saver, search); con.ShowMainMenu(); }
public ViewOrderViewModel() { LoadFromFile load = new LoadFromFile(); if (!load.FromCsv()) { Orders = new ObservableCollection <Order>(); } else { Orders = new ObservableCollection <Order>(load.Orders); } }
} // Link button to relaycommand //Constructor loads email JSON file public ViewEmailViewModel() { LoadFromFile load = new LoadFromFile(); if (!load.FromJsonEMAIL()) { emailMessages = new ObservableCollection <Email>(); } else { emailMessages = new ObservableCollection <Email>(load.EmailMessages); } ClearDataButtonText = "Clear Data"; // Text to be displayed on button ClearButtonCommand = new RelayCommand(ClearDataButtonClick); // When clicked button will call send method }
//запуск теста мниста private void mnistTestButton_Click(object sender, EventArgs e) { if (Information.NN == null) { printErrorMessage("NN не создана"); return; } if (Information.isMnistLearn && Information.answNames.Count == 10) { ReadMnist readMnist = new ReadMnist(false, true); string[] fileNames2 = Information.answNames.ToArray(); LoadFromFile lF2 = new LoadFromFile(fileNames2); List <List <float> > answList = lF2.ConvertIntoList(); Information.NN.MnistTest(readMnist, answList); } else { MessageBox.Show("Error Mnist Learn Not Active"); } }
// Contructor loads JSON files for tweets public ViewTweetViewModel() { LoadFromFile load = new LoadFromFile(); ViewTrendsText = "View Trends"; if (!load.FromJsonTWEET()) { tweetMessages = new ObservableCollection <Tweet>(); } else { tweetMessages = new ObservableCollection <Tweet>(load.TweetMessages); } BodyTextBox = string.Empty; ClearDataButtonText = "Clear Data"; // Text to be displayed on button ClearButtonCommand = new RelayCommand(ClearDataButtonClick); // When clicked button will call send method }
//запуск из файла Run НН private void openRunNN(object sender, EventArgs e) { Information.inputSignals.Clear(); openFileDialog1.FileName = "Файл Для Запуска"; openFileDialog1.Filter = "*(*.txt)|*.txt"; openFileDialog1.InitialDirectory = Directory.GetCurrentDirectory(); //выбрать файл if (openFileDialog1.ShowDialog() == DialogResult.OK) { string str = "Выбран файл: "; str += openFileDialog1.FileName; MessageBox.Show(str); } string[] fileNames = new string[] { openFileDialog1.FileName }; LoadFromFile lF = new LoadFromFile(fileNames); Information.inputSignals = lF.ConvertIntoList()[0]; if (Information.NN.IsBiasNeuron) { Information.inputSignals.Add(1); } consoleRunNN(); }
//Начать учить НН private async void startLearnNN(object sender, EventArgs e) { int MaxEp; if (int.TryParse(textBoxLearnRate.Text, out MaxEp)) { Information.NN.MaxEp = MaxEp; } int DistPrint; if (int.TryParse(textBoxMoment.Text, out DistPrint)) { Information.NN.DistPrint = DistPrint; } if (Information.pattNames.Count == Information.answNames.Count && Information.pattNames.Count != 0) { string[] fileNames1 = Information.pattNames.ToArray(); LoadFromFile lF1 = new LoadFromFile(fileNames1); string[] fileNames2 = Information.answNames.ToArray(); LoadFromFile lF2 = new LoadFromFile(fileNames2); List <List <float> > pattList = lF1.ConvertIntoList(); List <List <float> > answList = lF2.ConvertIntoList(); Information.NN.Learning(pattList.Count, pattList, answList); } else if (Information.isMnistLearn && Information.answNames.Count == 10) { ReadMnist readMnist = new ReadMnist(true, false); //File.WriteAllLines("mnist_data.txt", Information.mnistStrs); string[] fileNames2 = Information.answNames.ToArray(); LoadFromFile lF2 = new LoadFromFile(fileNames2); List <List <float> > answList = lF2.ConvertIntoList(); Information.NN.LearningMnist(readMnist, answList); } else if (Information.isFormatLearn) { if (Information.NN != null) { openFileDialog1.FileName = "Выбор файла NN"; openFileDialog1.Filter = "*(*.txt)|*.txt"; openFileDialog1.InitialDirectory = Directory.GetCurrentDirectory() + @"\formatData"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { string filePath = openFileDialog1.FileName; Information.FormatFilePath = filePath; Tuple <PatternsType, KeysType, AnswersType> data = FormatLoad(filePath); PatternsType pattList = data.Item1; KeysType keys = data.Item2; AnswersType answList = data.Item3; await Information.NN.LearningFormat(pattList, keys, answList); } else { FormConsole.PrintlnAndScroll("erroe open file dialog"); } } else { FormConsole.PrintlnAndScroll("erroe NN is not define"); } } else { printErrorMessage("Неверно заданы образцы и ответы"); } }