mirror of
https://github.com/ikoHSE/KDZ1.git
synced 2024-11-24 09:35:55 +03:00
42 lines
997 B
C#
42 lines
997 B
C#
using System.Windows.Forms;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
|
|
namespace Frequencies {
|
|
public class MainForm: Form {
|
|
|
|
public MainForm(): base() {
|
|
Text = "Frequencies";
|
|
MinimumSize = new System.Drawing.Size(750, 500);
|
|
DoubleBuffered = true;
|
|
Layout += (_, __) => {
|
|
currentView?.Layout(ClientSize);
|
|
};
|
|
BackColor = Color.White;
|
|
}
|
|
|
|
private View currentView;
|
|
|
|
public void Present(View view) {
|
|
currentView = view;
|
|
Controls.Clear();
|
|
Controls.AddRange(view.controlsArray);
|
|
Invalidate();
|
|
Refresh();
|
|
}
|
|
}
|
|
|
|
abstract public class View {
|
|
protected List<Control> controls = new List<Control>();
|
|
public Control[] controlsArray {
|
|
get {
|
|
return controls.ToArray();
|
|
}
|
|
}
|
|
|
|
abstract public void Layout(Size rect);
|
|
}
|
|
}
|
|
|
|
|