in

Archived Data Techniques Forums

Remove Faxman modem

Last post 10-03-2008 7:07 AM by MikeS. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 09-29-2008 4:23 AM

    Remove Faxman modem

    Hi,

    I using FAXMAN V. 4.4.4.0 in .net application. i cannot able to remove faxman modem from application. i also check faxman help file but there are very few information has written. First, simply i try to remove using this code "faxman.modems.remove(portno)" but cannot remove modems from a modem list. Then i also check a property of AllowRemove but this property return "False" which means cannot allow to remove. I cannot find where to change this (allowRemove) property and why it does not remove a modem, even issuce a remove method.

     Thank you

     

     Regards and Metta,

    Sailung

  • 10-01-2008 8:39 PM In reply to

    Re: Remove Faxman modem

    Hi,

    Anyone have an idea to remove modem from faxman modem pool. using "Remove" method cannot remove a modem from faxman modem pool.

    Thank you

     

     

    Regards

    Sailung

  • 10-02-2008 6:57 AM In reply to

    • MikeS
    • Top 25 Contributor
    • Joined on 07-20-2007
    • Posts 39

    Re: Remove Faxman modem

    Here is what I am doing.

    This has not been tested extensively.
    Pretty sure it works. I do  have a comment in there about doing  it twice....

    VS2005

    Private Sub btnRemoveModem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemoveModem.Click
            ' This will remove the currently selected modem.
            ' will need to get the port number from the gridline
            ' still need to pause faxing

            ' Verify user selection
            Result = MessageBox.Show("Confirm Fax Modem Removal?", _
                                     Me.Tag.ToString & "- Confirm Removal", _
                                     MessageBoxButtons.OKCancel, _
                                     MessageBoxIcon.Question, _
                                     MessageBoxDefaultButton.Button2)
            If Result = DialogResult.OK Then
                PauseFaxing("Remove")

                If fmain.objStatus.IsFaxActive = False And Result = DialogResult.OK Then

                    Dim selectedRowCount As Integer = _
                                 Me.grdModems.Rows.GetRowCount(DataGridViewElementStates.Selected)
                    ' should only be able to select a single row at at time.
                    If selectedRowCount > 0 Then
                        Dim md As New pviModem
                        md = GetRowData(md)
                        lblStatus.Text = Nothing
                        isaddremovecompleted = False
                        myfaxman.Modems.Remove(md.Port)
                        lblStatus.Text = "Removing Modem..."
                        Dim StartTime As System.DateTime = DateTime.Now
                        While Not isaddremovecompleted And DateTime.Now < StartTime.AddSeconds(10)
                            PVI.Utility.pause(1)
                            lblStatus.Text = lblStatus.Text & "."
                        End While
                        ' this is stil not working right.
                        ' have to do it twice to really get it removed.
                        isaddremovecompleted = False
                        StartTime = DateTime.Now
                        myfaxman.Modems.Remove(md.Port)
                        While Not isaddremovecompleted And DateTime.Now < StartTime.AddSeconds(10)
                            PVI.Utility.pause(1)
                            lblStatus.Text = lblStatus.Text & "."
                        End While

                        If isaddremovecompleted Then
                            lblStatus.Text = "Modem Removed"
                            Me.PostColumnCreation()
                            fmain.objStatus.lvModemStatus.Items.Clear()
                            fmain.objStatus.RefreshModemsListView()
                        Else
                            MessageBox.Show("Fax Modem remove did not complete.", _
                                            Me.Tag.ToString & " - Removing Fax Modem", _
                                            MessageBoxButtons.OK, _
                                            MessageBoxIcon.Error)
                        End If
                    Else
                        MessageBox.Show("Fax Modem is not selected.", _
                                         Me.Tag.ToString & " - Removing Fax Modem", _
                                         MessageBoxButtons.OK, _
                                         MessageBoxIcon.Error)
                    End If
                End If
                Me.btnModemAutoDetect.Enabled = True
                Me.btnFindModem.Enabled = True
                Me.btnRemoveModem.Enabled = True
                fm.PauseFaxActivity(False)
            End If
        End Sub

     

     

  • 10-02-2008 11:34 PM In reply to

    Re: Remove Faxman modem

     

    Hi mike,

    Please refer a last comment.

     Thank you

  • 10-02-2008 11:52 PM In reply to

    Re: Remove Faxman modem

    Hi,

    How to remove the device specified by port number from the faxman server list of the faxmodem using .NET application. Actually, i want completely remove device rather then, only faxman modem from the list.

     

     Regards

    Sailung

     

  • 10-03-2008 2:22 AM In reply to

    Re: Remove Faxman modem

    Hi Mike,

    May i know what kind of method is this " PVI.Utility.pause(1)" which you have mention in remove event handler and how does your program response "isaddremovecompleted" is true after being issue twice remove method with in while loop...., i does not seen where it (isaddremovecompleted) invoke within a program. well, my intentation is completely removed device from a faxserver modem list.

    One more question, what does  PauseFaxing("Remove") method do? is there any specific command that can pause a faxing except issue a modem class member. As i know in modem class property allow change value of field such as send, recieve and other member etc.. 

     I am looking forward your reply.

     Regards,

    Sailung

  • 10-03-2008 7:07 AM In reply to

    • MikeS
    • Top 25 Contributor
    • Joined on 07-20-2007
    • Posts 39

    Re: Remove Faxman modem

    Hi Sailung

    isaddremovecompleted is set to true when the modemlistchanged event fires.

    Private Sub fax_ModemsListChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ListChangedEventArgs)
            ' ctrlModems_Load has an add handler call in it for this.
            ' apparently thats the only way the HANDLES FAXMAN1.Modems.ListChanged can be trapped.
            ' MessageBox.Show("Have received Modem List Changed Event.")
            ' this gets hit first on remove
            BeginInvoke(New myModemListChangedDelegate(AddressOf ModemListChanged), New Object() {sender, e})
        End Sub

        Private Sub ModemListChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ListChangedEventArgs)
            ' MessageBox.Show("ListChangeEvent: " & e.ListChangedType)
            ' this is being fired on btnModemRemoved. 04/22/08
            isaddremovecompleted = True
            Select Case e.ListChangedType
                Case ListChangedType.ItemDeleted
                Case ListChangedType.ItemAdded
            End Select
        End Sub

    Pause Faxing, in one of the later version of faxman 4.x a pause method was added.
    This will allow any faxes currently being sent or received to finsh and not allow any new
    faxes to be received or sent.

    PauseFaxing calls that PauseFaxActivity which does the faxman function to stop faxing.
    It then waits until for the faxmodems to go inactive, displaying a message screen while waiting.
    The Operation parameter (REMOVE) in this case is just a string to display in the message screen as to what is happening.

     Private Sub PauseFaxing(ByVal Operation As String)
            btnModemAutoDetect.Enabled = False
            Me.btnFindModem.Enabled = False
            Me.btnRemoveModem.Enabled = False
            fm.PauseFaxActivity(True)
            ' wait for activity to stop.
            Dim myform As New dlgModemDetect(Operation)
            myform.fmain = fmain
            Result = DialogResult.OK
            ' only display this if FAXING is active
            If fmain.objStatus.IsFaxActive = True Then
                Result = myform.ShowDialog
            End If
        End Sub 

       Public Function PauseFaxActivity(ByVal value As Boolean) As Boolean
            Dim Result As Boolean
            'Using Fax As New FaxMan
            If isFaxManActive Then
                Select Case value
                    Case True
                        myFaxMan.Server.Item("ServerStatus") = "Paused"
                        PVI.Utility.LogHistory(fMain_Manager.objStatus.lvStatus, _
                                    "Info - Server Status Paused", PVI.Utility.AppLogFileFullPath)
                    Case False
                        myFaxMan.Server.Item("ServerStatus") = "Running"
                        PVI.Utility.LogHistory(fMain_Manager.objStatus.lvStatus, _
                               "Info - Server Status Running", _
                               PVI.Utility.AppLogFileFullPath)
                End Select
                Result = True
            End If
            'End Using
        End Function

    isFaxManActive just checks the status of the faxman service.
    Cannot Pause Faxing if service is not active.

        ''' <summary>
        ''' Used to check to see if the FAXMAN service is active (running)
        ''' </summary>
        ''' <value></value>
        ''' <returns>
        ''' True = Service is running
        ''' False = Service is either not installed or is not running.
        ''' </returns>
        ''' <remarks></remarks>
        Public ReadOnly Property isFaxManActive() As Boolean
            Get
                init_Controller()
                Dim _servicestatus As String = Nothing
                Try
                    _servicestatus = controller.Status.ToString
                Catch ex As System.InvalidOperationException
                    _servicestatus = "Disabled"
                Finally
                    Select Case _servicestatus
                        Case "Running"
                            isFaxManActive = True
                        Case "Stopped", "Disabled"
                            isFaxManActive = False
                    End Select
                End Try
            End Get
        End Property 

    PVI.Utility.pause(1) is just a delay(1 second) to allow the remove action to complete.
      Public Shared Sub pause(ByVal seconds As Int32)
                Dim starttime As DateTime = DateTime.Now
                Do Until DateTime.Now > starttime.AddSeconds(seconds)
                    Application.DoEvents()
                Loop
            End Sub

Page 1 of 1 (7 items)
Copyright 2009 Data Techniques, Inc. All Rights Reserved.