public RestForm(Database database)
 {
     InitializeComponent();
     this.database = database;
     action = () => { this.Invoke(new Action(Rest_Changed)); };
     this.database.Rest_Changed += action;
     this.OneTimer.Elapsed += (sender, e) => { this.Invoke(new Action(Rest_Changed)); };
     this.OneTimer.Start();
     this.RestView.Style();
 }
 public MainForm(Database database)
 {
     InitializeComponent();
     this.database = database;
     this.form = new StaticForms(database);
     this.ITowerBrowser.LoginCompletedEvent += this.ITowerBrowser_LoginCompleted;
     this.ITowerBrowser.LoginErrorEvent += this.ITowerBrowser_LoginError;
     this.ITowerBrowser.MuteChangedEvent += (isMute) => { this.Invoke(new Action<bool>(ITowerBrowser_MuteImageChange), isMute); };
     Version version = Assembly.GetExecutingAssembly().GetName().Version;
     this.Text = string.Format("回転建機 ver {0}.{1}.{2}", version.Major, version.Minor, version.Build);
 }
        static void Main()
        {
            bool run = true;

            #if !DEBUG
            // 二重起動を防止する
            using (Mutex mutex = new Mutex(false, Application.ProductName))
            {
                run = mutex.WaitOne(0, false);
            }
            #endif

            if (run)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                var login = LoginInfo.Load();
                if (!login.IsExists())
                {
                    var frm = new LoginForm();
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        login = frm.LoginData;
                        LoginInfo.Save(login);
                    }
                }

                if (login.IsExists())
                {
                    var sw = new SessionWrapper(8892);
                    var database = new Database(sw);
                    Application.Run(new MainForm(database));
                }
            }
        }
 public StaticForms(Database database)
 {
     this.database = database;
 }