Source

vlocity-vinstall-gambas / Vlocity / .svn / text-base / FrmRestart.class.svn-base

' Gambas class file
PRIVATE i AS Integer

PUBLIC SUB Run() AS Boolean

  RETURN NOT ME.ShowModal()

END

PUBLIC SUB btnOK_Click()

  SHELL "shutdown -frn now & "
  ME.Close(TRUE)

END

PUBLIC SUB btnCancel_Click()
  Timer1.Enabled = FALSE
  ClsGlobal.fRunningMainForm.btnext.enabled = TRUE
  ME.Close

END


PUBLIC SUB Form_Open()
  
  btnOK.Width = MdlObjSizer.get_object_width(btnOK.Text) + 48
  btnCancel.Width = MdlObjSizer.get_object_width(btnCancel.Text) + 48
  ClsGlobal.fRunningMainForm.enabled = FALSE
  ME.Center
  ProgressBar1.Value = 1
  
  'frame1.Width = frame1.Parent.Width
  SHELL "cp /root/gui.log /mnt/target/var/log/installation.log"
  i = 10
END

PUBLIC SUB Timer1_Timer()
  DIM sTime AS String

  IF i > 0 THEN 
    IF i > 1 THEN 
      sTime = ("seconds")
    ELSE 
      sTime = ("second")
    END IF
    TextLabel1.Text = ("This computer will restart in") & Space(1) & i & Space(1) & sTime
    ProgressBar1.Value = ProgressBar1.Value - 0.10
    DEC i
    
    WAIT 1
  ELSE 
    Timer1.Enabled = FALSE
    SHELL "shutdown -frn now &"
    ME.Close()
  END IF
    
      

END

PUBLIC SUB Form_Close()

  ClsGlobal.fRunningMainForm.enabled = TRUE

END