protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // UI init SetContentView(Resource.Layout.Main); StatusLabel = FindViewById<TextView>(Resource.Id.StatusTextView); LogView = FindViewById<TextView>(Resource.Id.LogTextView); var createUserButton = FindViewById<Button>(Resource.Id.CreateUserButton); var loginButton = FindViewById<Button>(Resource.Id.LoginButton); var logoffButton = FindViewById<Button>(Resource.Id.LogoffButton); createUserButton.Click += new EventHandler(CreateUserButton_Click); loginButton.Click += new EventHandler(LoginButton_Click); logoffButton.Click += new EventHandler(LogoffButton_Click); // context init Context = new DeOpsContext(CacheDir.Path, null); OpName = "Global IM"; Username = "******"; Password = "******"; UserFile = OpName + " - " + Username; UserPath = CacheDir.Path + Path.DirectorySeparatorChar + UserFile + Path.DirectorySeparatorChar + UserFile + ".dop"; }
public void Run() { StartupPath = AppDomain.CurrentDomain.BaseDirectory; try { LogFile = new StreamWriter(new FileStream("log.txt", FileMode.Create, FileAccess.Write, FileShare.Read)); } catch (Exception ex) { Console.WriteLine("Error creating output file: " + ex.Message); return; } Context = new DeOpsContext(StartupPath, null); WriteOut("DeOps Alpha v" + Context.LocalSeqVersion.ToString()); if (File.Exists("init.txt")) { using (var init = new StreamReader(File.OpenRead("init.txt"))) { string line = null; do { line = init.ReadLine(); if (line == null) break; if (line.StartsWith("#")) continue; Console.WriteLine("> " + line); if (!ProcessInput(line)) return; } while (line != null); } } while (true) { Console.Write("> "); string input = Console.ReadLine(); // input is null if daemon so just loopity loop if (input == null) { Thread.Sleep(5000); continue; } if (!ProcessInput(input)) return; } }
//string UpdatePath; // news page used to alert users of non-autoupdates public AppContext(string[] args) { // if instance already running, signal it and exit SingleInstance = new DeOpsMutex(this, args); if (!SingleInstance.First) { return; } // open windows firewall //Win32.AuthorizeApplication("DeOps", Application.ExecutablePath, // NetFwTypeLib.NET_FW_SCOPE_.NET_FW_SCOPE_ALL, NetFwTypeLib.NET_FW_IP_VERSION_.NET_FW_IP_VERSION_ANY); //CheckForUpdates(); // register file types //RegisterType(); // upgrade properties if we need to Settings = AppSettings.Load(Path.Combine(Application.StartupPath, "app.xml")); FastTimer.Interval = 250; FastTimer.Tick += new EventHandler(FastTimer_Tick); FastTimer.Enabled = true; Context = new DeOpsContext(Application.StartupPath, InterfaceRes.deops); Context.ShowLogin += ShowLogin; Context.NotifyUpdateReady += NotifyUpdateReady; if (Context.CanUpdate() && NotifyUpdateReady(Context.LookupConfig)) { return; } // display login form ShowLogin(args); StartSuccess = true; }
//string UpdatePath; // news page used to alert users of non-autoupdates public AppContext(string[] args) { // if instance already running, signal it and exit SingleInstance = new DeOpsMutex(this, args); if (!SingleInstance.First) return; // open windows firewall //Win32.AuthorizeApplication("DeOps", Application.ExecutablePath, // NetFwTypeLib.NET_FW_SCOPE_.NET_FW_SCOPE_ALL, NetFwTypeLib.NET_FW_IP_VERSION_.NET_FW_IP_VERSION_ANY); //CheckForUpdates(); // register file types //RegisterType(); // upgrade properties if we need to Settings = AppSettings.Load(Path.Combine(Application.StartupPath, "app.xml")); FastTimer.Interval = 250; FastTimer.Tick += new EventHandler(FastTimer_Tick); FastTimer.Enabled = true; Context = new DeOpsContext(Application.StartupPath, InterfaceRes.deops); Context.ShowLogin += ShowLogin; Context.NotifyUpdateReady += NotifyUpdateReady; if (Context.CanUpdate() && NotifyUpdateReady(Context.LookupConfig)) return; // display login form ShowLogin(args); StartSuccess = true; }