using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EOwnMessageBox
{
public class Window
{
///
/// Controls the appearance of a window.
///
public Window()
{
SetWindowSize(Size.Micro); //Initialisiere ein Fenster
}
public enum Size
{
Nano,
Micro,
Mini,
Midi,
Maxi,
Magnum
}
public enum ControlBox
{
Off,
On
}
public enum BorderStyle
{
Fix,
Sizeable
}
public enum TopMost
{
Off,
On
}
///
/// Stores the current window size.
///
public Size CurrentWindowSize { private set; get; }
///
/// Stores the size values of the current window.
///
public int[] CurrentWindowSizeValue { private set; get; }
///
/// Stores the current control box setting.
///
public ControlBox CurrentControlBox { private set; get; }
///
/// Stores the border sizeable setting.
///
public BorderStyle CurrentBorderStyle { private set; get; }
///
/// Stores the window most on top setting.
///
public TopMost CurrentTopMostStatus { private set; get; }
///
/// Sets the widht and height size of a window.
///
/// A valid window size. Possible options are: 'Nano' (360x270), 'Micro' (480x360), 'Mini' (640x480), 'Midi' (850x640), 'Maxi' (1020x770) und 'Magnum' (1360x1020).
/// Returns the widht and height value of the window.
public int[] SetWindowSize(Size size)
{
int[] windowsSize = new int[2];
switch (size)
{
case Size.Nano:
windowsSize[0] = 360;
windowsSize[1] = 270;
break;
case Size.Mini:
windowsSize[0] = 640;
windowsSize[1] = 480;
break;
case Size.Midi:
windowsSize[0] = 850;
windowsSize[1] = 640;
break;
case Size.Maxi:
windowsSize[0] = 1020;
windowsSize[1] = 770;
break;
case Size.Magnum:
windowsSize[0] = 1360;
windowsSize[1] = 1020;
break;
default:
windowsSize[0] = 480;
windowsSize[1] = 360;
break; //Size.Micro
}
CurrentWindowSize = size;
CurrentWindowSizeValue = windowsSize;
return CurrentWindowSizeValue;
}
///
/// Sets the controlbox of a window.
///
/// A valid option. Possible options are 'Off' and 'On'.
/// Returns the control box status.
public Window.ControlBox SetControlBox(ControlBox controlBox)
{
CurrentControlBox = controlBox;
return controlBox;
}
///
/// Sets the border style of a window.
///
/// A valid option. Possible options are 'Fix' and 'Sizeable'.
/// Returns the control box status.
public Window.BorderStyle SetBorderStyle(BorderStyle borderStyle)
{
CurrentBorderStyle = borderStyle;
return borderStyle;
}
///
/// Sets whether the window is most on top.
///
/// A valid option. Possible options are 'Off' and 'On'.
/// Returns the most on top status.
public Window.TopMost SetTopMost(TopMost topMost)
{
CurrentTopMostStatus = topMost;
return topMost;
}
///
/// Returns the Window X-Size
///
/// A valid window size. E.g.: 'Window.Size.Mini'
///
public static int XSize(Window.Size winSize)
{
var win = new Window();
return win.SetWindowSize(winSize)[0];
}
///
/// Returns the Window Y-Size
///
/// A valid window size. E.g.: 'Window.Size.Mini'
///
public static int YSize(Window.Size winSize)
{
var win = new Window();
return win.SetWindowSize(winSize)[1]; ;
}
}
}