Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Class1
- {
- public partial class MainWindow : Window
- {
- public TextBox getBox() { return this.textbox1; }//1. не работает
- public string TextBoxText // 2. тоже не работает.
- {
- set { TAlert.Text = value; }
- get { return TAlert.Text; }
- }
- public MainWindow()
- {
- InitializeComponent();
- }
- public void Button_Click_1(object sender, RoutedEventArgs e)
- {
- Class2 a= new Class2(this);
- }
- }
- }
- ------------------------------------------------------------------------------------------
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Class1
- {
- class Class2
- {
- public MainWindow wnd;
- public System.Windows.Controls.TextBox t;
- Timer timer = new Timer(3000);
- public Class2(MainWindow win)
- {
- wnd = win;
- t = wnd.getBox();
- timer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
- timer.Enabled = true;
- }
- public void OnTimedEvent(object sender, ElapsedEventArgs e)
- {
- System.Windows.Controls.TextBox t = MainWindow.getBox();
- t.Text +="Тут строки\n";
- wnd.TextBoxText += "Тут тоже не работает \n";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment