public ViewManager(RegClientInfor clientInfor) { _clientInfor = clientInfor; _components = new System.ComponentModel.Container(); _notifyIcon = new System.Windows.Forms.NotifyIcon(_components) { ContextMenuStrip = new ContextMenuStrip(), Icon = FileTracking.Client.Application.Properties.Resources.NotReadyIcon, Text = "File Tracking", Visible = true, }; _notifyIcon.ContextMenuStrip.Opening += ContextMenuStrip_Opening; _notifyIcon.DoubleClick += notifyIcon_DoubleClick; _notifyIcon.MouseUp += notifyIcon_MouseUp; _hiddenWindow = new System.Windows.Window(); _hiddenWindow.Hide(); _frmLog = new frmLogging(); _frmLog.LoggingText = ""; InitConnect(); checkWebSocketTimer = new System.Timers.Timer(); checkWebSocketTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); checkWebSocketTimer.Interval = 60000; checkWebSocketTimer.Enabled = true; }
public frmConfigure() { InitializeComponent(); clientInfor = RegManager.LoadConfig(); txtFolderPath.Text = clientInfor.FolderPath; txtPassword.Text = clientInfor.UserInfor.Password; txtUsername.Text = clientInfor.UserInfor.Username; }
private void ShowConfigureFrom_Click(object sender, EventArgs e) { if ((_frmConfigure == null) || (!_frmConfigure.Visible)) { _frmConfigure = new frmConfigure(); var result = _frmConfigure.ShowDialog(); if (result == DialogResult.OK) { _clientInfor = RegManager.LoadConfig(); } } }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { wb = this.Application; wb.DocumentChange += Wb_DocumentChange; clientInfor = RegManager.LoadConfig(); //TODO: for test if (string.IsNullOrEmpty(clientInfor.UserInfor.Username)) { clientInfor = new RegClientInfor(); clientInfor.UserInfor = new LoginObject(); clientInfor.UserInfor.Username = "******"; clientInfor.UserInfor.Password = "******"; clientInfor.FolderPath = @"C:\ApplicationFiles"; RegManager.SaveConfig(clientInfor); } StartConnectionAsync(clientInfor.UserInfor); _connection.OnFileMessage += _connection_OnFileMessage; _connection.OnMessage += _connection_OnMessage; }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { wb = this.Application; wb.WorkbookActivate += Wb_WorkbookActivate; // ((Excel.Worksheet)Globals.ThisWorkbook.ActiveSheet).SelectionChange += new Excel.DocEvents_SelectionChangeEventHandler(activeSheet_SelectionChange); clientInfor = RegManager.LoadConfig(); //TODO: for test if (string.IsNullOrEmpty(clientInfor.UserInfor.Username)) { clientInfor = new RegClientInfor(); clientInfor.UserInfor = new LoginObject(); clientInfor.UserInfor.Username = "******"; clientInfor.UserInfor.Password = "******"; clientInfor.FolderPath = @"C:\ApplicationFiles"; RegManager.SaveConfig(clientInfor); } StartConnectionAsync(clientInfor.UserInfor); _connection.OnFileMessage += _connection_OnFileMessage; _connection.OnMessage += _connection_OnMessage; }
static void Main() { // Use the assembly GUID as the name of the mutex which we use to detect if an application instance is already running bool createdNew = false; string mutexName = System.Reflection.Assembly.GetExecutingAssembly().GetType().GUID.ToString(); using (System.Threading.Mutex mutex = new System.Threading.Mutex(false, mutexName, out createdNew)) { if (!createdNew) { // Only allow one instance return; } System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); RegClientInfor clientInfor = RegManager.LoadConfig(); //TODO: for test if (string.IsNullOrEmpty(clientInfor.UserInfor.Username)) { clientInfor = new RegClientInfor(); clientInfor.UserInfor = new LoginObject(); clientInfor.UserInfor.Username = "******"; clientInfor.UserInfor.Password = "******"; clientInfor.FolderPath = @"C:\ApplicationFiles"; RegManager.SaveConfig(clientInfor); } try { STAApplicationContext context = new STAApplicationContext(clientInfor); System.Windows.Forms.Application.Run(context); } catch (Exception exc) { MessageBox.Show(exc.Message, "Error"); } } }
public STAApplicationContext(RegClientInfor clientInfor) { _viewManager = new ViewManager(clientInfor); //_clientWebSocketManager.OnStatusChange += _viewManager.OnStatusChange; }