Beispiel #1
0
        private void RefreshLocalDevices()
        {
            panel_FlowLayoutDevices.Controls.Clear();


            NetComm.ScoutNetworkDevices();
        }
Beispiel #2
0
        public Panel CreateLocalDevicesElement(Point location, int width, int height, Form _form)
        {
            mainForm            = _form;
            FileDisplayList     = new List <DarkFileDisplay>();
            MainPanel           = new Panel();
            MainPanel.Location  = location;
            MainPanel.Size      = new Size(width, height);
            MainPanel.BackColor = Color.Transparent;

            Panel DeviceScoutPanel = CreateDeviceScoutPanel();

            MainPanel.Controls.Add(DeviceScoutPanel);

            FileDisplayMinX = DeviceScoutPanel.Location.X + DeviceScoutPanel.Width;

            CreateFileAreaPanel(FileDisplayMinX);
            CreateFileUploadVisualPanel();
            panel_FlowLayoutFiles.Visible = false;

            panel_DragDropFiles = CreateFileDropSendPanel(FileDisplayMinX);
            FileAreaPanel.Controls.Add(panel_DragDropFiles);


            // Create the various state panels



            FileAreaPanel.Visible = false;

            panel_ButtonsMain = new Panel();

            panel_ButtonsMain.Location = new Point(FileAreaPanel.Location.X, FileAreaPanel.Location.Y + FileAreaPanel.Height + 10);
            panel_ButtonsMain.Size     = new Size(FileAreaPanel.Width, 200);
            MainPanel.Controls.Add(panel_ButtonsMain);

            panel_SendFiles         = CreateSendButtons();
            panel_SendFiles.Visible = false;;
            panel_ButtonsMain.Controls.Add(panel_SendFiles);
            panel_ButtonsMain.Controls.Add(btn_TerminateTransfers);


            ChangeGuiState(GUIState.NoDeviceSelected);


            DataProcessor.NetworkDiscoveryEvent += NetworkDiscoveryEvent;

            NetComm.ScoutNetworkDevices();

            // Subscribe to events
            DataProcessor.OutboundTransferFinished += Transferfinished;
            DataProcessor.OutboundTransferStarted  += TransferStarted;
            DataProcessor.OutboundTransferProgress += TransferProgress;


            return(MainPanel);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 private void btn_RefreshNetwork_Click(object sender, EventArgs e)
 {
     DevicesCount = 0;
     ResetGUIDevices();
     NetComm.ScoutNetworkDevices();
 }