private void InitializeNetwork() { // Get the correct registry key for startup rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); // Settings #if DEBUG ChangeDestinationFolder("C:/FileJumpFolder"); ChangeDeviceName("CARLO_BB"); UserSettings.DeviceType = 1; // HARDCODED. Desktop application #else UserSettings.DeviceType = 1; // HARDCODED. Desktop application if (UserSettings.MachineName == "NULL") { ChangeDeviceName(Environment.MachineName); } // If the destination folder has not been specified, use the default one (main folder / Incoming Files) if (!Directory.Exists(UserSettings.DestinationFolder)) { ChangeDestinationFolder(Path.Combine(Directory.GetCurrentDirectory(), "Incoming Files")); } // // Check the startup setting //if (UserSettings.RunOnStartUp == true) //{ // startup_Checkbox.CheckState = CheckState.Checked; // This also automatically runs AddToStartup which checks if it is running on startup, //} // else it adds it. //else //{ // startup_Checkbox.CheckState = CheckState.Unchecked; // This runs the remove check //} #endif NetComm.InitializeNetwork(UserSettings.MachineName, UserSettings.DeviceType, UserSettings.DestinationFolder, new FileHandler()); }
public MainPage() { InitializeComponent(); label_LoggedInText.Visible = false; panel_RegisterLogin.Visible = true; // Get the correct registry key for startup rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); // Settings #if DEBUG ChangeDestinationFolder("C:/FileJumpFolder"); ChangeDeviceName("CARLO_BB"); UserSettings.DeviceType = 1; // HARDCODED. Desktop application startup_Checkbox.CheckState = CheckState.Unchecked; #else UserSettings.DeviceType = 1; // HARDCODED. Desktop application if (UserSettings.MachineName == "NULL") { ChangeDeviceName(Environment.MachineName); } // If the destination folder has not been specified, use the default one (main folder / Incoming Files) if (!Directory.Exists(UserSettings.DestinationFolder)) { ChangeDestinationFolder(Path.Combine(Directory.GetCurrentDirectory(), "Incoming Files")); } // Check the startup setting if (UserSettings.RunOnStartUp == true) { startup_Checkbox.CheckState = CheckState.Checked; // This also automatically runs AddToStartup which checks if it is running on startup, } // else it adds it. else { startup_Checkbox.CheckState = CheckState.Unchecked; // This runs the remove check } #endif NetComm.InitializeNetwork(UserSettings.MachineName, UserSettings.DeviceType, UserSettings.DestinationFolder, new FileHandler()); // Notifications settings tray_icon.BalloonTipShown += Tray_icon_BalloonTipShown; tray_icon.BalloonTipClosed += Tray_icon_BalloonTipClosed; tray_icon.BalloonTipClicked += Tray_icon_BalloonTipClicked; // Subscribe to events DataProcessor.NetworkDiscoveryEvent += NetworkDiscoveryReceived; DataProcessor.IncomingTransferFinished += IncomingTransferFinished; DataProcessor.InboundTextTransferFinished += InboundTextTransferFinished; ApiCommunication.LoginActionResult += LoginResultEvent; ApiCommunication.LogoutActionResult += LogoutResultEvent; // Form events btn_OnlineFiles.Click += btn_OnlineStorage; btn_Topbar_Close.MouseEnter += OnTopBarButtonEnter; btn_Topbar_Close.MouseLeave += OnTopBarButtonLeave; btn_Topbar_Minimize.MouseEnter += OnTopBarButtonEnter; btn_Topbar_Minimize.MouseLeave += OnTopBarButtonLeave; // Some buttons settings btn_Register.MouseEnter += (s, e) => btn_Register.Cursor = Cursors.Hand; btn_Register.MouseLeave += (s, e) => btn_Register.Cursor = Cursors.Arrow; btn_Login.MouseEnter += (s, e) => btn_Login.Cursor = Cursors.Hand; btn_Login.MouseLeave += (s, e) => btn_Login.Cursor = Cursors.Arrow; btn_Register.MouseClick += btn_Register_Click; btn_Login.MouseClick += btn_Login_Click; // Reset the devices count and run a scan DevicesCount = 0; NetComm.ScoutNetworkDevices(); CheckIfShouldPerformLogin(); panel_TopBar.Location = new Point(1, 1); panel_TopBar.Size = new Size(this.Size.Width - 2, 23); }