Exemple #1
0
 private void GuiThreadEntry(System.Threading.ManualResetEvent e)
 {
     m_running = true;
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     WS7I_antennas.WS7I_ratpak form = new WS7I_antennas.WS7I_ratpak(getSerial(), e);
     // calls from WriteLog are on the wrong thread. Use BeginInvoke to
     // cross-thread them.
     m_closeThread = () => {
         form.BeginInvoke(new Action(form.Close));
     };
     m_doShortcut = (int i) => {
         form.BeginInvoke(new Action <int>(form.DoShortcut), i);
     };
     m_command = (String s) =>
     {
         form.BeginInvoke(new Action <String>(form.Command), s);
     };
     Application.Run(form); // stay in here as long as form is up.
     m_running = false;
     form.Dispose();
     m_command     = null;
     m_doShortcut  = null;
     m_closeThread = null;
     m_doShortcut  = null;
 }
Exemple #2
0
        public SharingForm(List <User> userList, ConcurrentDictionary <SharingForm, String> sharingFormList, string sourcePath, Options options, SettingsForm settingsForm, Flag isCreated)
        {
            InitializeComponent();
            this.sourcePath      = sourcePath;
            this.options         = options;
            this.sharingFormList = sharingFormList;
            this.settingsForm    = settingsForm;
            this.isCreated       = isCreated;
            userCollection       = new ObservableCollection <User>(userList);

            SettingList();
            PrintList();
            EditTitleBar();

            //set delegate
            addItemDelegate     = new AddRemoveChangeItem(this.AddItemMethod);
            removeItemDelegate  = new AddRemoveChangeItem(this.RemoveItemMethod);
            changeItemDelegate  = new AddRemoveChangeItem(this.ChangeItemMethod);
            closeThreadDelegate = new CloseThread(this.CloseForm);

            threadList = new HashSet <Thread>();
        }
 protected void CloseForm()
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.InvokeRequired)
     {
         CloseThread d = new CloseThread(Close);
         this.Invoke(d, new object[] { });
     }
     else
     {
         Hide();
     }
 }
Exemple #4
0
        public SettingsForm(String path)
        {
            this.options    = new Options();
            userList        = new List <User>();
            threadFormList  = new Dictionary <Thread, SharingForm>();
            sharingFormList = new ConcurrentDictionary <SharingForm, String>();

            InitializeComponent();
            EditTitleBar();
            SetNoIcon();

            UserName.Text = options.Name;
            DestPath.Text = options.DestPath;

            AutomaticReceptionP.Size = new Size(60, 25);
            System.Windows.Forms.ToolTip ToolTip1 = new System.Windows.Forms.ToolTip();
            ToolTip1.SetToolTip(this.AutomaticReception, "autoRec Info");

            AutomaticReceptionP.BackColor = Color.FromArgb(220, 220, 220);
            PrivateModeP.BackColor        = Color.FromArgb(220, 220, 220);

            AutomaticReception.Size       = new Size(45, 45);
            AutomaticReception.Appearance = Appearance.Button;
            AutomaticReception.FlatStyle  = FlatStyle.Flat;
            AutomaticReception.FlatAppearance.BorderSize = 0;
            AutomaticReception.Checked = options.RicMode;

            PrivateModeP.Size = new Size(60, 25);
            System.Windows.Forms.ToolTip ToolTip2 = new System.Windows.Forms.ToolTip();
            ToolTip1.SetToolTip(this.PrivateMode, "Private mode Info");

            PrivateMode.Size       = new Size(45, 45);
            PrivateMode.Appearance = Appearance.Button;

            PrivateMode.FlatStyle = FlatStyle.Flat;

            PrivateMode.FlatAppearance.BorderSize = 0;
            PrivateMode.Checked = options.PrivateMode;

            CheckBoxApparence(PrivateMode);
            CheckBoxApparence(AutomaticReception);

            //set changeNetwork callback
            NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(AddressChangedCallback);

            //set delegates
            CloseThreadDelegate   = new CloseThread(this.CloseThreadMethod);
            DownloadStateDelegate = new DownloadState(this.notifyFile);

            DestPath.Text         = options.DestPath;
            DestPath.AutoEllipsis = true;

            System.Windows.Forms.ToolTip ToolTip = new System.Windows.Forms.ToolTip();
            ToolTip1.SetToolTip(this.CP_Button, "Change Path of the receiving folder");

            if (path != null)
            {
                //hide settingsForm and launch SharingForm

                this.path = path;
            }
        }