コード例 #1
0
        public override void Commit(IDictionary savedState)
        {
            MDShowEventLog.Install();

            string   oldDirectory = Directory.GetCurrentDirectory();
            FileInfo fi           = new FileInfo(Assembly.GetExecutingAssembly().Location);

            Directory.SetCurrentDirectory(fi.Directory.FullName);

            try
            {
                RegisterCxpRtpFilters();
            }
            catch (DllNotFoundException)
            {
                RtlAwareMessageBox.Show(null, Strings.MissingCxpRtpFiltersError, Strings.FileNotFound,
                                        MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
            }

            try
            {
                RegisterScreenScraperFilter();
            }
            catch (DllNotFoundException)
            {
                RtlAwareMessageBox.Show(null, Strings.MissingScreenScraperFilterError, Strings.FileNotFound,
                                        MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
            }

            Directory.SetCurrentDirectory(oldDirectory);
        }
コード例 #2
0
        /// <summary>
        /// Choose the files to make available for playing, puts them all in the 'selected' state
        /// </summary>
        private void btnSelect_Click(object sender, System.EventArgs e)
        {
            // Type of files supported
            ofd.Filter = "WM Files (*.wmv;*.wma)|*.wmv;*.wma";

            if (ofd.ShowDialog(this) == DialogResult.OK)
            {
                file = ofd.FileName;

                if (file != null)
                {
                    string exn = System.IO.Path.GetExtension(file).ToLower(CultureInfo.InvariantCulture);

                    if (exn != ".wmv" && exn != ".wma")
                    {
                        RtlAwareMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture,
                                                                    Strings.UnexpectedFileExtension, exn, file), string.Empty, MessageBoxButtons.OK,
                                                MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);

                        file = null;
                    }
                    else
                    {
                        btnStop.PerformClick(); // stop the old file

                        lblInfo.Text = string.Format(CultureInfo.CurrentCulture, Strings.SelectedFile, file);
                    }
                }

                btnPlay.Enabled = (file != null);
                btnPlay.PerformClick(); // play the new file (just ignores if disabled)
            }
        }
コード例 #3
0
        protected override void OnCommitted(IDictionary savedState)
        {
            base.OnCommitted(savedState);

            // Setting the "Allow Interact with Desktop" option for this service.
            ConnectionOptions connOpt = new ConnectionOptions();

            connOpt.Impersonation = ImpersonationLevel.Impersonate;
            ManagementScope mgmtScope = new ManagementScope(@"root\CIMv2", connOpt);

            mgmtScope.Connect();
            ManagementObject     wmiService = new ManagementObject("Win32_Service.Name='" + ReflectorMgr.ReflectorServiceName + "'");
            ManagementBaseObject inParam    = wmiService.GetMethodParameters("Change");

            inParam["DesktopInteract"] = true;
            ManagementBaseObject outParam = wmiService.InvokeMethod("Change", inParam, null);

            #region Start the reflector service immediately
            try
            {
                ServiceController sc = new ServiceController("ConferenceXP Reflector Service");
                sc.Start();
            }
            catch (Exception ex)
            {
                // Don't except - that would cause a rollback.  Instead, just tell the user.
                RtlAwareMessageBox.Show(null, string.Format(CultureInfo.CurrentCulture, Strings.ServiceStartFailureText,
                                                            ex.ToString()), Strings.ServiceStartFailureTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning,
                                        MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
            }
            #endregion
        }
コード例 #4
0
 private void buttonAccept_Click(object sender, EventArgs e)
 {
     if (this.checkBoxUsesServerProxy.Checked)
     {
         int result = 0;
         if (!int.TryParse(this.textBoxServerPort.Text, out result))
         {
             RtlAwareMessageBox.Show(this, "El puerto debe ser númerico", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
             this.textBoxServerPort.Focus();
             return;
         }
         if (!Uri.IsWellFormedUriString(this.textBoxServerProxy.Text, UriKind.Absolute))
         {
             RtlAwareMessageBox.Show(this, "El servidor proxy es no válido", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
             this.textBoxServerProxy.Focus();
             return;
         }
         Uri uri = new Uri(this.textBoxServerProxy.Text, UriKind.Absolute);
         if (uri.Scheme == Uri.UriSchemeNetTcp || uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)
         {
             RtlAwareMessageBox.Show(this, "El servidor proxy debe ser una IP, Http ó Https", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
             this.textBoxServerProxy.Focus();
             return;
         }
     }
     configuration.UsesProxy   = checkBoxUsesServerProxy.Checked;
     configuration.ProxyServer = textBoxServerProxy.Text;
     configuration.ProxyPort   = textBoxServerPort.Text;
     this.Close();
 }
コード例 #5
0
        public void startServiceBtn_Click(object sender, System.EventArgs e)
        {
            if (service.Running)
            {
                RtlAwareMessageBox.Show(this, Strings.ServiceStartedText, Strings.ServiceStartedTitle,
                                        MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1,
                                        (MessageBoxOptions)0);
            }
            else
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    service.StartServiceAndWait();
                    OnServiceStarted(EventArgs.Empty);
                }
                catch (System.ServiceProcess.TimeoutException)
                {
                    RtlAwareMessageBox.Show(this, Strings.ServiceStartTimeoutText, Strings.ServiceStartTimeoutTitle,
                                            MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1,
                                            (MessageBoxOptions)0);
                }
                finally
                {
                    Cursor.Current = Cursors.Default;
                }
            }

            SetServiceStatus();
        }
コード例 #6
0
        private void okBtn_Click(object sender, System.EventArgs e)
        {
            bool ownerValid = ValidateOwnerInput();
            bool ipValid    = ValidateIPInput();
            bool portValid  = ValidatePortInput();

            if (portValid && ipValid && ownerValid)
            {
                // The input is valid.  Just return.
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                // Just show one message for one bad input & send the user back to fix the one input
                string error = null;
                if (!ownerValid)
                {
                    error = Strings.InvalidOwnerInput;
                }
                else if (!ipValid)
                {
                    error = Strings.InvalidIPAddressInput;
                }
                else if (!portValid)
                {
                    error = Strings.InvalidPortInput;
                }

                RtlAwareMessageBox.Show(this, error, Strings.InvalidInput, MessageBoxButtons.OK,
                                        MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
            }
        }
コード例 #7
0
        private void btnStartStop_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (btnStartStop.Text == Start)
                {
                    if (fgm == null)
                    {
                        BuildFilterGraph();

                        // Changing the bit rate on the fly hasn't been tested yet
                        hsbBitRate.Enabled = false;
                    }

                    fgm.Run();
                    btnStartStop.Text = Stop;
                }
                else
                {
                    // Pause, don't Stop, otherwise the media clock needs to be reset on the source
                    // filter, and that isn't implemented yet.  jasonv 3/29/2005
                    fgm.Pause();
                    btnStartStop.Text = Start;
                }
            }
            catch (Exception ex)
            {
                RtlAwareMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, Strings.DataStreamError,
                                                            ex.ToString()), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None,
                                        MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
            }
        }
コード例 #8
0
 private static void AddCapabilitySenderClass(string fileName, Type type, string capName,
                                              CapabilitySenderClassHashtable capabilitySenderClasses)
 {
     try
     {
         if (!capabilitySenderClasses.ContainsKey(capName))
         {
             capabilitySenderClasses.Add(capName, type);
         }
         else
         {
             string msg = string.Format(CultureInfo.CurrentCulture, Strings.FoundDuplicateCapabilitySender,
                                        capName, fileName);
             eventLog.WriteEntry(msg, EventLogEntryType.Error, 23);
             RtlAwareMessageBox.Show(null, msg, Strings.ErrorInitializingCapabilityClasses,
                                     MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1,
                                     (MessageBoxOptions)0);
         }
     }
     catch (Exception e)
     {
         eventLog.WriteEntry(string.Format(CultureInfo.CurrentCulture, Strings.AccessingFile, fileName,
                                           e.ToString()), EventLogEntryType.Error, 99);
         RtlAwareMessageBox.Show(null, string.Format(CultureInfo.CurrentCulture, Strings.AccessingFile,
                                                     fileName, e.ToString()), Strings.ErrorInitializingCapabilitySender, MessageBoxButtons.OK,
                                 MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
     }
 }
コード例 #9
0
        private void AdminUI_Load(object sender, System.EventArgs e)
        {
            this.refreshBtn.Font      = UIFont.StringFont;
            this.forceLeaveBtn.Font   = UIFont.StringFont;
            this.participantsLbl.Font = UIFont.StringFont;
            this.clientAddress.Font   = UIFont.StringFont;
            this.tableListBox.Font    = UIFont.StringFont;
            this.groupAddress.Font    = UIFont.StringFont;
            this.joinTime.Font        = UIFont.StringFont;
            this.serviceBtns.Font     = UIFont.StringFont;
            this.serviceControl.Font  = UIFont.StringFont;

            this.refreshBtn.Text      = Strings.Refresh;
            this.forceLeaveBtn.Text   = Strings.ForceLeave;
            this.participantsLbl.Text = Strings.ReflectorParticipants;
            this.clientAddress.Text   = Strings.ClientAddress;
            //this.lblJoinPort.Text = Strings.ReflectorJoinPort;
            this.groupAddress.Text = Strings.GroupAddress;
            this.joinTime.Text     = Strings.JoinTime;
            this.Text = Strings.ConferenceXPReflectorServiceManager;

            // Connect to service (if we can)
            if (serviceControl.ConnectToService())
            {
                SetState(serviceControl.ServiceController.Running);
            }
            else
            {
                // Report errors about both connections in one dialog
                RtlAwareMessageBox.Show(this, Strings.ErrorConnectingText, Strings.ErrorConnectingTitle,
                                        MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
                Close();
            }
        }
コード例 #10
0
 private void btnApply_Click(object sender, System.EventArgs e)
 {
     RtlAwareMessageBox.Show(this, Strings.TheseSettingsWillTakeEffect, Strings.Information,
                             MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1,
                             (MessageBoxOptions)0);
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
コード例 #11
0
        private void aboutBtn_Click(object sender, System.EventArgs e)
        {
            string versions =
                GetAssemblyDescription(Assembly.GetExecutingAssembly()) + "\n" +
                GetAssemblyDescription(Assembly.Load("Storage"));

            RtlAwareMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture,
                                                        Strings.AboutConferencexpVenueServiceText, versions), Strings.AboutConferencexpVenueServiceTitle,
                                    MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
        }
コード例 #12
0
        private void CheckAdministratorRole()
        {
            WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent());

            if (wp.IsInRole(WindowsBuiltInRole.Administrator) == false)
            {
                RtlAwareMessageBox.Show(null, Strings.AdministratorRoleIsRequired, Strings.ConferencexpReflector,
                                        MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
                Application.Exit();
            }
        }
コード例 #13
0
        private void cmdClearIcon_Click(object sender, System.EventArgs e)
        {
            DialogResult dr = RtlAwareMessageBox.Show(this, Strings.ConfirmDefaultIconRestoreText,
                                                      Strings.ConfirmDefaultIconRestoreTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Warning,
                                                      MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);

            if (dr == DialogResult.Yes)
            {
                IconAsBytes = null;  // sets the default icon
            }
        }
コード例 #14
0
        private bool ValidateUniqueHost(string host)
        {
            if (this.listBoxServices.Items.Contains(host))
            {
                RtlAwareMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, Strings.DuplicateHostNameText,
                                                            serviceText.ConnectionType), Strings.DuplicateHostNameTitle, MessageBoxButtons.OK,
                                        MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
                return(false);
            }

            return(true);
        }
コード例 #15
0
        private void OptionsDialog_Closing(object sender, CancelEventArgs e)
        {
            // Verify the user has selected something permissible
            if (options.SelectedText.Trim() == null)
            {
                RtlAwareMessageBox.Show(this, Strings.PleaseEnterAValidResponse, string.Empty, MessageBoxButtons.OK,
                                        MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
                return;
            }

            this.DialogResult = DialogResult.OK;
        }
コード例 #16
0
        private void buttonDelete_Click(object sender, System.EventArgs e)
        {
            string key = listBoxServices.SelectedItem.ToString();

            DialogResult dr = RtlAwareMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture,
                                                                          Strings.ConfirmDeleteServiceHost, key), Strings.ConfirmDelete, MessageBoxButtons.OKCancel,
                                                      MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);

            if (dr == DialogResult.OK)
            {
                listBoxServices.Items.Remove(key);
            }
        }
コード例 #17
0
        private void DuplicateCNameDetected(object sender, RtpEvents.DuplicateCNameDetectedEventArgs ea)
        {
            if (sender == rtpSession)
            {
                string msg = string.Format(CultureInfo.CurrentCulture, Strings.DuplicateCnameWasDetected,
                                           ea.IPAddresses[0].ToString(), ea.IPAddresses[1].ToString());

                eventLog.WriteEntry(msg, EventLogEntryType.Error, 0);
                RtlAwareMessageBox.Show(null, msg, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None,
                                        MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);

                Dispose();
            }
        }