public ForecastPage() { InitializeComponent(); viewModel = new MainWeatherViewModel(); viewModel.Title = "Prognoza pogody"; BindingContext = viewModel; }
public MainWeatherPage() { InitializeComponent(); viewModel = new MainWeatherViewModel(); viewModel.Title = "Aktualna pogoda"; BindingContext = viewModel; }
public MainWeatherPage() { InitializeComponent(); var pageService = new PageService(); ViewModel = new MainWeatherViewModel(pageService); }
private void AddTextToFile(MainWeatherViewModel mainWeatherViewModel, string filePath) { var stringBuilder = new StringBuilder(); string[] weatherArray = { mainWeatherViewModel.City, mainWeatherViewModel.Temperature, mainWeatherViewModel.Pressure, mainWeatherViewModel.Wind, mainWeatherViewModel.Clouds, mainWeatherViewModel.Humidity, mainWeatherViewModel.Sunrise, mainWeatherViewModel.Sunset }; stringBuilder.Append(string.Join(";", weatherArray)); File.AppendAllText(filePath, stringBuilder.ToString()); }
private void AddTextToFile(StreamWriter txt, MainWeatherViewModel mainWeatherViewModel) { txt.Write("Miasto: " + mainWeatherViewModel.City + Environment.NewLine); txt.Write("Temperatura: " + mainWeatherViewModel.Temperature + Environment.NewLine); txt.Write("Ciśnienie: " + mainWeatherViewModel.Pressure + Environment.NewLine); txt.Write("Wiatr: " + mainWeatherViewModel.Wind + Environment.NewLine); txt.Write("Zachmurzenie: " + mainWeatherViewModel.Clouds + Environment.NewLine); txt.Write("Wilgotność: " + mainWeatherViewModel.Humidity + Environment.NewLine); txt.Write("Wschód Słońca: " + mainWeatherViewModel.Sunrise + Environment.NewLine); txt.Write("Zachód Słońca: " + mainWeatherViewModel.Sunset + Environment.NewLine); txt.Close(); }
private void AddTextToFile(PdfDocument pdfDocument, MainWeatherViewModel mainWeatherViewModel) { PdfPage page = pdfDocument.AddPage(); XGraphics xGraphics = XGraphics.FromPdfPage(page); XFont font = new XFont("Verdana", 20, XFontStyle.BoldItalic); xGraphics.DrawString("Miasto: " + mainWeatherViewModel.City, font, XBrushes.Black, 30, 50); xGraphics.DrawString("Temperatura: " + mainWeatherViewModel.Temperature, font, XBrushes.Black, 30, 80); xGraphics.DrawString("Ciśnienie: " + mainWeatherViewModel.Pressure, font, XBrushes.Black, 30, 110); xGraphics.DrawString("Wiatr: " + mainWeatherViewModel.Wind, font, XBrushes.Black, 30, 140); xGraphics.DrawString("Zachmurzenie: " + mainWeatherViewModel.Clouds, font, XBrushes.Black, 30, 170); xGraphics.DrawString("Wilgotność: " + mainWeatherViewModel.Humidity, font, XBrushes.Black, 30, 200); xGraphics.DrawString("Wschód Słońca: " + mainWeatherViewModel.Sunrise, font, XBrushes.Black, 30, 230); xGraphics.DrawString("Zachód Słońca " + mainWeatherViewModel.Sunset, font, XBrushes.Black, 30, 260); }
public void CreateFile(MainWeatherViewModel mainWeatherViewModel) { var filePath = GetFilePath(); if (filePath == "") { MessageBox.Show("Nie podano nazwy pliku!"); return; } else { CreateFile(filePath); } AddTextToFile(mainWeatherViewModel, filePath); MessageBox.Show("Plik CSV został zapisany!"); }
public void CreateFile(MainWeatherViewModel mainWeatherViewModel) { StreamWriter txt; var filePath = GetFilePath(); if (filePath == "") { MessageBox.Show("Nie podano nazwy pliku!"); return; } else { txt = CreateFile(filePath); } AddTextToFile(txt, mainWeatherViewModel); MessageBox.Show("Plik TXT został zapisany!"); }
public void CreateFile(MainWeatherViewModel mainWeatherViewModel) { var pdfDocument = CreateFile(); AddTextToFile(pdfDocument, mainWeatherViewModel); var filePath = GetFilePath(); if (filePath == "") { MessageBox.Show("Nie podano nazwy pliku!"); return; } else { pdfDocument.Save(filePath); } MessageBox.Show("Plik PDF został zapisany!"); }
/// <summary> /// 天气按钮 /// </summary> /// <param name="element"></param> private void Weather(ButtonBase element) { Task.Factory.StartNew(() => { //Thread.Sleep(500); DispatcherHelper.CheckBeginInvokeOnUI( () => { MainWeatherView view = new MainWeatherView(); MainWeatherViewModel viewModel = new MainWeatherViewModel(Now, DailyModel, DegreeFormat); viewModel.SearchResult += SearchCity; view.DataContext = viewModel; view.Show(); }); }).ContinueWith(result => { if (result.IsFaulted) { } }); }
public MainWeatherView() { InitializeComponent(); mainWeatherViewModel = new MainWeatherViewModel(); openWeatherMapService = new OpenWeatherMapService(); }
public MainWeatherView() { InitializeComponent(); BindingContext = new MainWeatherViewModel(this.Navigation); }