|
8751
|
Programación / Scripting / Re: QPF to Chapter file
|
en: 12 Julio 2013, 18:07 pm
|
¿Algo está mal? ¿Acaso no se puede operar con numeros decimales? Exacto, ese es el problema, Batch no soporta operaciones con decimales. Aunque se pueden llegar a hacer, pero es un jaleo de código y porsupuesto no es algo " nativo" que digamos, diréctamente te recomiendo cualquier otro lenguaje. Si no quieres depender de tener un intérprete instalado en el PC entonces te iría bien usar VBScript, javascript, O Powershell. Saludos!
|
|
|
8752
|
Programación / Scripting / Re: QPF to Chapter file
|
en: 12 Julio 2013, 09:43 am
|
me gustaria saber pq no me lista los numeros. No estás usando comillas en el comando agrupado, no le estás indicando al FOR que se trata de un archivo, en lugar de eso estás usando comillas dobles así que estás leyendo interpretando un String " ...\10. QPFILE_NAME.txt", no el contenido del archivo. Hay dos formas de hacerlo, una es usando el parámetro " usebackq" del FOR y usar sólo comillas, y la otra es usando la sintaxis correcta del For agrupando un comando con comillas: ...In ('Type "archivo"') Do..., bueno, aquí tienes la sintaxis: FOR /F ["options"] %%parameter IN ('command_to_process') DO command usebackq Use the alternate quoting style: - Use double quotes for long file names in "filenameset". - Use single quotes for 'Text string to process' - Use back quotes for `command_to_process` FOR /F "usebackq delims=" %%A IN ( "C:\Users\Isra\Desktop\Nueva carpeta\10. QPFILE_NAME.txt" )
Saludos
|
|
|
8754
|
Programación / .NET (C#, VB.NET, ASP) / Re: [SOURCECODE] -> WTF! (WinampToFolder)
|
en: 11 Julio 2013, 15:49 pm
|
seria excelente (para mi) si utilizaras el framework 2.0, sólo por compatibilidad Imposible, uso Linq y métodos del FW 4.0, demasiada tarea como para poder pasarlo al 2.0.
v1.5 Cambios: - Añadido soporte para arrastrar y soltar archivos de música a la lista del monitor. - La lista del monitor ahora se puede reorganizar clickando en las columnas. - El menú contextual de la lista del monitor ya no está disponible cuando se están enviando canciones a los directorios. - Opción añadida en el menú contextual para modificar la carpeta de destino de una canción préviamente agregada. - Opción añadida en el menú contextual para eliminar todas las canciones de la lista. - Opción añadida en el menú contextual para copiar una cancion de la lista. - Algunos elementos importantes del monitor se activan al pasar el ratón por encima de ellos, consiguiendo una rapidez de uso extra. (La barra de volumen, la barra de posición, el combobox y el listview). - Tiple click para seleccionar todo el texto en los textboxes. - Añadido preguntas de confirmación para eliminar un archivo de la lista y/o para limpiar la lista. 
|
|
|
8755
|
Informática / Software / Re: Modificar ISO.
|
en: 10 Julio 2013, 21:55 pm
|
1. El sistema operativo da igual, es para aplicarlo a cualquier güindous. ¿Y si hubiese sido para Linux y te doy una contestación de 10 páginas sobre una solución para Windows encontes que?. hay que especificar estos detalles hombre... llevo 10 minutos intentando descargar dicho archivo, el server está bastante colapsado o bastante jodido, no puedo descargarlo ni con JDownloader, ya veremos mañana. 3. ¿Como se llama el software que está grabado en la ISO? Éste software es de Gigabyte y se llama Xpress Recovery2, Comprueba si en la misma carpeta del executable hay algún archivo de configuración (cfg, ini, txt, etc...) que contenga parámetros personalizables configurables, por ejemplo algo como esto "Output=C:\", y encontes lo cambias. De lo contrario... no creo que haya nada que hacer. No he probado la aplicación pero como afirmas que es un proceso automático entonces lo más lógico es que la aplicación trabaje sobre el mismo disco duro donde se efectua la operación (porque la lógica de la aplicación sabe que ese disco duro existe), aunque no he programado yo la aplicación y pueden haber usado otra lógica, pero a mi me parecería algo muy ilógico por parte de los desarrolladores el hecho de permitirte modificar el HDD de destino, más que nada por si por un error humano o cualquier otra cosa la unidad de destino no existiese, entonces al ser un proceso automático habría un gran FAIL por parte del programa y adiós al backup. PD: No ayudo por privado, usemos el foro. Saludos
|
|
|
8756
|
Programación / .NET (C#, VB.NET, ASP) / Re: Self-extractor de Ionic Zip no esperado
|
en: 10 Julio 2013, 21:27 pm
|
...DotNetZip es un wrapper de WinZip, lo sabrías si lo hubiera leido, es obvio que no es lo mismo que WinRar...
Winrar no es opensource, y no hay ningún wrapper de winrar.
O usas .NetZip o usas 7zipsharp (Hay más, pero ni valen la pena xD).
1. Creas el archivo comprimido (SFX o sin ser SFX) 2. Creas la Gui y la hardcodeas para que se asemeje a la Gui de WinRar, y añades el archivo comprimido como recurso a tu proyecto, y también la librería para descomprimirlo. 3. Al darle al botón "Instalar" de tu Gui, pues descomprimes de forma automática y oculta el archivo que préviamente has comprimido en el paso 1 y añadido a tu Gui en el paso 2...
EDITO: Un sfx de 7zip lo puedes customizar muchísimo de aspecto y de tamaño (Puedes hacerlo con los metodos de sevenzipsharp agregando tu custom sfx modificado), las dos librerías son buenas pero en mi opinión dotnetzip no le llega a sevenzipsharp ni a la punta de... ejem, por el soporte de formatos y por la customización.
Saludos.
|
|
|
8757
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 10 Julio 2013, 20:30 pm
|
Integración para deshacer/rehacer (Undo/Redo) para estos controles: TextBox ComboBox DateTimePicker NumericUpDown MaskedTextBox ListBox (single and multi-select) CheckBox RadioButton MonthCalendar INSTRUCCIONES: 1. copiar las siguientes classes en el proyecto: '****************************************************************************************************************** ' Undo/Redo framework (c) Copyright 2009 Etienne Nijboer '****************************************************************************************************************** Public Enum UndoRedoCommandType ctNone ctUndo ctRedo End Enum Public Class UndoRedoManager #Region "UndoRedoMonitor auto register types" Private Shared RegisteredUndoRedoMonitorTypes As List(Of Type) = Nothing ' ScanAssembly ' The first created UndoRedoMonitor will scan the assembly for BaseUndoRedoMonitors and ' store these types in the monitor type list. ' Private Shared Sub ScanAssembly() If RegisteredUndoRedoMonitorTypes Is Nothing Then RegisteredUndoRedoMonitorTypes = New List(Of Type) Dim AssemblyTypes() As Type = Reflection.Assembly.GetExecutingAssembly().GetTypes() Dim BaseUndoRedoMonitorType As Type = GetType(BaseUndoRedoMonitor) For Each typeItem As Type In AssemblyTypes If typeItem.BaseType Is BaseUndoRedoMonitorType Then RegisteredUndoRedoMonitorTypes.Add(typeItem) End If Next End If End Sub #End Region Private Control As Control = Nothing Private UndoRedoMonitors As List(Of BaseUndoRedoMonitor) Private ExcludeControls As List(Of Control) ' InitializeUndoRedoMonitors ' When a new UndoRedoManager instance is created, a new instance of each registered monitor ' is created and used only within the scope of this UndoRedoManager, preventing temporary data ' moved to another UndoRedoManager. This is because Each form, or group control like a panel ' to make seperate undo/redo groups on a single form, can have it's own UndoRedoManager. It is ' of course also possible to use one global UndoRedoManager for multiple forms. This lets you ' control how data is seperated or combined, depending on the relation between te undo/redo commands. Private Sub InitializeUndoRedoMonitors() ScanAssembly() UndoRedoMonitors = New List(Of BaseUndoRedoMonitor) For Each typeItem In RegisteredUndoRedoMonitorTypes UndoRedoMonitors.Add(Activator.CreateInstance(typeItem, Me)) Next End Sub Public Sub New() InitializeUndoRedoMonitors() End Sub Public Sub New(ByVal AControl As Control) Me.New(AControl, New List(Of Control)) End Sub Public Sub New(ByVal AControl As Control, ByVal AExcludeControls As List(Of Control)) Me.New() ExcludeControls = AExcludeControls MonitorControl(AControl) End Sub Public Sub New(ByVal AControl As Control, ByVal ParamArray AExcludeControls() As Control) Me.New(AControl, AExcludeControls.ToList) End Sub ' MonitorControl ' If a given control is not in the list of controls to exclude from undo/redo actions, ' an attempt is made to attach it to a matching UndoRedoMonitor. If no direct match is ' found, a same attempt is made for each control contained within the control recursively. Private Sub MonitorControl(ByVal AControl As Control) If Not ExcludeControls.Contains(AControl) Then If Not BindMonitor(AControl) Then For Each ctl As Control In AControl.Controls MonitorControl(ctl) Next End If End If End Sub ' BindMonitor ' An attempt is made to bind the control to a each registered monitor. When a match is ' found the search ends and the function will return true, false otherwise meaning there ' is no specific UndoRedoMonitor for this control. Private Function BindMonitor(ByVal AControl As Control) As Boolean Dim index As Integer = UndoRedoMonitors.Count - 1, result As Boolean = False While index >= 0 And Not result result = UndoRedoMonitors(index).Monitor(AControl) index -= 1 End While Return result End Function Public Sub Monitor(ByVal AControl As Control) MonitorControl(AControl) End Sub Private undoStack As Stack(Of BaseUndoRedoCommand) = New Stack(Of BaseUndoRedoCommand) Private redoStack As Stack(Of BaseUndoRedoCommand) = New Stack(Of BaseUndoRedoCommand) Private _undoRedoCommand As UndoRedoCommandType = UndoRedoCommandType.ctNone Private _canUndo As Boolean = False Private _canRedo As Boolean = False Public Event CanUndoChanged(ByVal Sender As Object, ByVal CanUndo As Boolean) Public Event CanRedoChanged(ByVal Sender As Object, ByVal CanRedo As Boolean) Public Event UndoRedoStacksChanged(ByVal Sender As Object) Private Sub UpdateCanUndoRedo() Dim isCanUndoChanged As Boolean = Not (undoStack.Count > 0) = _canUndo, _ isCanRedoChanged As Boolean = Not (redoStack.Count > 0) = _canRedo _canUndo = undoStack.Count > 0 _canRedo = redoStack.Count > 0 If isCanUndoChanged Then RaiseEvent CanUndoChanged(Me, _canUndo) End If If isCanRedoChanged Then RaiseEvent CanRedoChanged(Me, _canRedo) End If RaiseEvent UndoRedoStacksChanged(Me) End Sub Public ReadOnly Property isUndoing() As Boolean Get Return _undoRedoCommand = UndoRedoCommandType.ctUndo End Get End Property Public ReadOnly Property isRedoing() As Boolean Get Return _undoRedoCommand = UndoRedoCommandType.ctRedo End Get End Property Public ReadOnly Property isPerformingUndoRedo() As Boolean Get Return _undoRedoCommand <> UndoRedoCommandType.ctNone End Get End Property Public ReadOnly Property CanUndo() As Boolean Get Return _canUndo End Get End Property Public ReadOnly Property CanRedo() As Boolean Get Return _canRedo End Get End Property Public Sub AddUndoCommand(ByVal UndoRedoCommand As BaseUndoRedoCommand) If Not isUndoing Then undoStack.Push(UndoRedoCommand) If Not isRedoing Then redoStack.Clear() UpdateCanUndoRedo() End If End If End Sub Public Sub AddRedoCommand(ByVal UndoRedoCommand As BaseUndoRedoCommand) If Not isRedoing Then redoStack.Push(UndoRedoCommand) If Not isUndoing Then UpdateCanUndoRedo() End If End If End Sub Public Sub AddCommand(ByVal UndoRedoCommandType As UndoRedoCommandType, ByVal UndoRedoCommand As BaseUndoRedoCommand) Select Case UndoRedoCommandType Case UndoRedoCommandType.ctUndo AddUndoCommand(UndoRedoCommand) Case UndoRedoCommandType.ctRedo AddRedoCommand(UndoRedoCommand) Case Else Throw New Exception("An undo or redo command could not be accepted.") End Select End Sub Public Sub Undo() If CanUndo Then 'Try _undoRedoCommand = UndoRedoCommandType.ctUndo undoStack.Pop.Undo() 'Catch e As Exception 'Finally UpdateCanUndoRedo() _undoRedoCommand = UndoRedoCommandType.ctNone 'End Try End If End Sub Public Sub Redo() If CanRedo Then _undoRedoCommand = UndoRedoCommandType.ctRedo redoStack.Pop.Redo() UpdateCanUndoRedo() _undoRedoCommand = UndoRedoCommandType.ctNone End If End Sub Protected Overrides Sub Finalize() MyBase.Finalize() End Sub #Region "debug info" Public Shared Function ArrayToString(ByVal ObjectArray() As Object) As String Dim sb As New System.Text.StringBuilder For Each item As Object In ObjectArray sb.AppendLine(item.ToString) Next Return sb.ToString End Function Public Function GetUndoStack() As String Return ArrayToString(undoStack.ToArray) End Function Public Function GetRedoStack() As String Return ArrayToString(redoStack.ToArray) End Function Public Function GetRegisteredUndoRedoMonitorTypes() As String Return ArrayToString(RegisteredUndoRedoMonitorTypes.ToArray) End Function #End Region End Class
'****************************************************************************************************************** ' Undo/Redo framework (c) Copyright 2009 Etienne Nijboer '****************************************************************************************************************** Public MustInherit Class BaseUndoRedoMonitor Public Sub New(ByVal AUndoRedoManager As UndoRedoManager) _UndoRedoManager = AUndoRedoManager End Sub Private _UndoRedoManager As UndoRedoManager Public Property UndoRedoManager() As UndoRedoManager Get Return _UndoRedoManager End Get Set(ByVal value As UndoRedoManager) _UndoRedoManager = value End Set End Property Public ReadOnly Property isUndoing() As Boolean Get Return UndoRedoManager.isUndoing End Get End Property Public ReadOnly Property isRedoing() As Boolean Get Return UndoRedoManager.isRedoing End Get End Property Public ReadOnly Property isPerformingUndoRedo() As Boolean Get Return UndoRedoManager.isPerformingUndoRedo End Get End Property Public Sub AddCommand(ByVal UndoRedoCommandType As UndoRedoCommandType, ByVal UndoRedoCommand As BaseUndoRedoCommand) UndoRedoManager.AddCommand(UndoRedoCommandType, UndoRedoCommand) End Sub Public MustOverride Function Monitor(ByVal AControl As Control) As Boolean End Class '**************************************************************************************************************** ' SimpleControl ' Controls: TextBox, ComboBox, DateTimePicker, NumericUpDown, MaskedTextBox '**************************************************************************************************************** Public Class SimpleControlMonitor : Inherits BaseUndoRedoMonitor Private Data As String Public Sub New(ByVal AUndoRedoManager As UndoRedoManager) MyBase.New(AUndoRedoManager) End Sub Public Overrides Function Monitor(ByVal AControl As System.Windows.Forms.Control) As Boolean If TypeOf AControl Is TextBox Or _ TypeOf AControl Is ComboBox Or _ TypeOf AControl Is DateTimePicker Or _ TypeOf AControl Is NumericUpDown Or _ TypeOf AControl Is ListView Or _ TypeOf AControl Is MaskedTextBox Then AddHandler AControl.Enter, AddressOf Control_Enter AddHandler AControl.Leave, AddressOf Control_Leave Return True End If Return False End Function Private Sub Control_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Data = CType(sender, Control).Text End Sub Private Sub Control_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim CurrentData As String = CType(sender, Control).Text If Not String.Equals(CurrentData, Data) Then AddCommand(UndoRedoCommandType.ctUndo, New SimpleControlUndoRedoCommand(Me, sender, Data)) End If End Sub End Class '**************************************************************************************************************** ' ListBox '**************************************************************************************************************** Public Class ListBoxMonitor : Inherits BaseUndoRedoMonitor Private Data As Object Public Sub New(ByVal AUndoRedoManager As UndoRedoManager) MyBase.New(AUndoRedoManager) End Sub Public Overrides Function Monitor(ByVal AControl As System.Windows.Forms.Control) As Boolean If TypeOf AControl Is ListBox Then AddHandler AControl.Enter, AddressOf Control_Enter AddHandler CType(AControl, ListBox).SelectedIndexChanged, AddressOf Control_Changed Return True End If Return False End Function Public Function GetSelected(ByVal AListBox As Object) As String Dim Indices As List(Of String) = New List(Of String) For Each itemIndex As Integer In CType(AListBox, ListBox).SelectedIndices Indices.Add(CStr(itemIndex + 1)) Next Return String.Join(",", Indices.ToArray) End Function Public Sub RestoreSelected(ByVal AListBox As Object, ByVal ASelection As String) If Not String.IsNullOrEmpty(ASelection) Then Dim Indices As List(Of Integer) = New List(Of Integer)(Array.ConvertAll(ASelection.Split(","), New Converter(Of String, Integer)(AddressOf Integer.Parse))) Dim Control As ListBox = CType(AListBox, ListBox) Select Case Control.SelectionMode Case SelectionMode.None Case SelectionMode.One Control.SetSelected(Indices(0) - 1, True) Case SelectionMode.MultiSimple, SelectionMode.MultiExtended For index As Integer = 0 To Control.Items.Count - 1 Control.SetSelected(index, Indices.IndexOf(index + 1) >= 0) Next End Select Else CType(AListBox, ListBox).ClearSelected() End If End Sub Private Sub Control_Changed(ByVal sender As System.Object, ByVal e As System.EventArgs) ' Events that are also fired when the undo/redo value is changed by code, like change events, ' it is important to make sure that no undo/redo command is added when performing a undo/redo action. If Not isPerformingUndoRedo Then Dim CurrentData As String = GetSelected(sender) If Not String.Equals(Data, CurrentData) Then AddCommand(UndoRedoCommandType.ctUndo, New ListBoxUndoRedoCommand(Me, sender, Data)) Data = CurrentData End If End If End Sub Private Sub Control_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Data = GetSelected(sender) End Sub End Class '**************************************************************************************************************** ' CheckBox '**************************************************************************************************************** Public Class CheckBoxMonitor : Inherits BaseUndoRedoMonitor Private Data As CheckState Public Sub New(ByVal AUndoRedoManager As UndoRedoManager) MyBase.New(AUndoRedoManager) End Sub Public Overrides Function Monitor(ByVal AControl As System.Windows.Forms.Control) As Boolean If TypeOf AControl Is CheckBox Then AddHandler AControl.Enter, AddressOf Control_Enter AddHandler AControl.Leave, AddressOf Control_Leave Return True End If Return False End Function Private Sub Control_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Data = CType(sender, CheckBox).CheckState End Sub Private Sub Control_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim CurrentData As CheckState = CType(sender, CheckBox).CheckState If Data <> CurrentData Then AddCommand(UndoRedoCommandType.ctUndo, New CheckBoxUndoRedoCommand(Me, sender, Data)) End If End Sub End Class '**************************************************************************************************************** ' RadioButton '**************************************************************************************************************** Public Class RadioButtonMonitor : Inherits BaseUndoRedoMonitor Private Data As RadioButton Public Sub New(ByVal AUndoRedoManager As UndoRedoManager) MyBase.New(AUndoRedoManager) End Sub Public Overrides Function Monitor(ByVal AControl As System.Windows.Forms.Control) As Boolean If TypeOf AControl Is RadioButton Then AddHandler CType(AControl, RadioButton).CheckedChanged, AddressOf Control_CheckedChanged Return True End If Return False End Function Private Sub Control_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) ' Events that are also fired when the undo/redo value is changed by code, like change events, ' it is important to make sure that no undo/redo command is added when performing a undo/redo action. If Not isPerformingUndoRedo Then If CType(sender, RadioButton).Checked Then AddCommand(UndoRedoCommandType.ctUndo, New RadioButtonUndoRedoCommand(Me, sender, Data)) Else Data = sender End If End If End Sub End Class '**************************************************************************************************************** ' MonthCalendar '**************************************************************************************************************** Public Class MonthCalendarMonitor : Inherits BaseUndoRedoMonitor Private Data As SelectionRange Public Sub New(ByVal AUndoRedoManager As UndoRedoManager) MyBase.New(AUndoRedoManager) End Sub Public Overrides Function Monitor(ByVal AControl As System.Windows.Forms.Control) As Boolean If TypeOf AControl Is MonthCalendar Then AddHandler AControl.Enter, AddressOf Control_Enter AddHandler CType(AControl, MonthCalendar).DateSelected, AddressOf Control_DateSelected Return True End If Return False End Function Private Sub Control_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Data = CType(sender, MonthCalendar).SelectionRange End Sub Private Sub Control_DateSelected(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) ' Events that are also fired when the undo/redo value is changed by code, like selected events, ' it is important to make sure that no undo/redo command is added when performing a undo/redo action. If Not isPerformingUndoRedo Then Dim CurrentData As SelectionRange = CType(sender, MonthCalendar).SelectionRange If Not SelectionRange.Equals(Data, CurrentData) Then AddCommand(UndoRedoCommandType.ctUndo, New MonthCalendarUndoRedoCommand(Me, sender, Data)) Data = CurrentData End If End If End Sub End Class
'****************************************************************************************************************** ' Undo/Redo framework (c) Copyright 2009 Etienne Nijboer '****************************************************************************************************************** Public MustInherit Class BaseUndoRedoCommand Private _UndoRedoMonitor As BaseUndoRedoMonitor Private _UndoRedoControl As Control Private _UndoRedoData As Object Public ReadOnly Property UndoRedoMonitor() As BaseUndoRedoMonitor Get Return _UndoRedoMonitor End Get End Property Public ReadOnly Property UndoRedoControl() As Control Get Return _UndoRedoControl End Get End Property Protected Property UndoRedoData() As Object Get Return _UndoRedoData End Get Set(ByVal value As Object) _UndoRedoData = value End Set End Property Protected Sub New() Throw New Exception("Cannot create instance with the default constructor.") End Sub Public Sub New(ByVal AUndoRedoMonitor As BaseUndoRedoMonitor, ByVal AMonitorControl As Control) Me.New(AUndoRedoMonitor, AMonitorControl, Nothing) End Sub Public Sub New(ByVal AUndoRedoMonitor As BaseUndoRedoMonitor, ByVal AMonitorControl As Control, ByVal AUndoRedoData As Object) _UndoRedoMonitor = AUndoRedoMonitor _UndoRedoControl = AMonitorControl _UndoRedoData = AUndoRedoData End Sub Protected Sub AddCommand(ByVal UndoRedoCommandType As UndoRedoCommandType, ByVal UndoRedoCommand As BaseUndoRedoCommand) UndoRedoMonitor.AddCommand(UndoRedoCommandType, UndoRedoCommand) End Sub Public Overridable Sub Undo() AddCommand(UndoRedoCommandType.ctRedo, Activator.CreateInstance(Me.GetType, UndoRedoMonitor, UndoRedoControl)) End Sub Public Overridable Sub Redo() AddCommand(UndoRedoCommandType.ctUndo, Activator.CreateInstance(Me.GetType, UndoRedoMonitor, UndoRedoControl)) End Sub Public Overridable Sub Undo(ByVal RedoData As Object) AddCommand(UndoRedoCommandType.ctRedo, Activator.CreateInstance(Me.GetType, UndoRedoMonitor, UndoRedoControl, RedoData)) End Sub Public Overridable Sub Redo(ByVal UndoData As Object) AddCommand(UndoRedoCommandType.ctUndo, Activator.CreateInstance(Me.GetType, UndoRedoMonitor, UndoRedoControl, UndoData)) End Sub Public MustOverride Function CommandAsText() As String Public Overrides Function ToString() As String Return CommandAsText() End Function End Class '**************************************************************************************************************** ' SimpleControl ' Controls: TextBox, ComboBox, DateTimePicker, NumericUpDown, MaskedTextBox '**************************************************************************************************************** Public Class SimpleControlUndoRedoCommand : Inherits BaseUndoRedoCommand Protected ReadOnly Property UndoRedoText() As String Get Return CStr(UndoRedoData) End Get End Property Public Sub New(ByVal AUndoMonitor As BaseUndoRedoMonitor, ByVal AMonitorControl As Control) MyBase.New(AUndoMonitor, AMonitorControl) UndoRedoData = UndoRedoControl.Text End Sub Public Sub New(ByVal AUndoMonitor As BaseUndoRedoMonitor, ByVal AMonitorControl As Control, ByVal AUndoRedoData As String) MyBase.New(AUndoMonitor, AMonitorControl, AUndoRedoData) End Sub Public Overrides Sub Undo() MyBase.Undo() UndoRedoControl.Text = UndoRedoText End Sub Public Overrides Sub Redo() MyBase.Redo() UndoRedoControl.Text = UndoRedoText End Sub Public Overrides Function CommandAsText() As String Return String.Format("Change to '{0}'", UndoRedoText) End Function End Class '**************************************************************************************************************** ' ListBox '**************************************************************************************************************** Public Class ListBoxUndoRedoCommand : Inherits BaseUndoRedoCommand Public Sub New(ByVal AUndoMonitor As BaseUndoRedoMonitor, ByVal AMonitorControl As Control) MyBase.New(AUndoMonitor, AMonitorControl) UndoRedoData = GetSelection() End Sub Public Sub New(ByVal AUndoMonitor As BaseUndoRedoMonitor, ByVal AMonitorControl As Control, ByVal AUndoRedoData As Object) MyBase.New(AUndoMonitor, AMonitorControl, AUndoRedoData) End Sub Public ReadOnly Property Control() As ListBox Get Return CType(UndoRedoControl, ListBox) End Get End Property Private Sub RestoreSelection() CType(UndoRedoMonitor, ListBoxMonitor).RestoreSelected(UndoRedoControl, CStr(UndoRedoData)) End Sub Private Function GetSelection() As Object Return CType(UndoRedoMonitor, ListBoxMonitor).GetSelected(UndoRedoControl) End Function Public Overrides Sub Undo() MyBase.Undo() RestoreSelection() End Sub Public Overrides Sub Redo() MyBase.Redo() RestoreSelection() End Sub Public Overrides Function CommandAsText() As String Return String.Format("Select {0}", CStr(UndoRedoData)) End Function End Class '**************************************************************************************************************** ' CheckBox '**************************************************************************************************************** Public Class CheckBoxUndoRedoCommand : Inherits BaseUndoRedoCommand Protected ReadOnly Property UndoRedoCheckState() As CheckState Get Return CType(UndoRedoData, CheckState) End Get End Property Public Sub New(ByVal AUndoMonitor As BaseUndoRedoMonitor, ByVal AMonitorControl As Control) MyBase.New(AUndoMonitor, AMonitorControl) UndoRedoData = Control.CheckState End Sub Public Sub New(ByVal AUndoMonitor As BaseUndoRedoMonitor, ByVal AMonitorControl As Control, ByVal AUndoRedoData As String) MyBase.New(AUndoMonitor, AMonitorControl, AUndoRedoData) End Sub Public ReadOnly Property Control() As CheckBox Get Return CType(UndoRedoControl, CheckBox) End Get End Property Public Overrides Sub Undo() MyBase.Undo() Control.CheckState = UndoRedoCheckState End Sub Public Overrides Sub Redo() MyBase.Redo() Control.CheckState = UndoRedoCheckState End Sub Public Overrides Function CommandAsText() As String Return String.Format("Change to '{0}'", UndoRedoCheckState.ToString) End Function End Class '**************************************************************************************************************** ' RadioButton '**************************************************************************************************************** Public Class RadioButtonUndoRedoCommand : Inherits BaseUndoRedoCommand Protected ReadOnly Property UndoRedoRadioButton() As RadioButton Get Return CType(UndoRedoData, RadioButton) End Get End Property Public Sub New(ByVal AUndoMonitor As BaseUndoRedoMonitor, ByVal AMonitorControl As Control) MyBase.New(AUndoMonitor, AMonitorControl) UndoRedoData = Control.Checked End Sub Public Sub New(ByVal AUndoMonitor As BaseUndoRedoMonitor, ByVal AMonitorControl As Control, ByVal AUndoRedoData As Control) MyBase.New(AUndoMonitor, AMonitorControl, AUndoRedoData) End Sub Public ReadOnly Property Control() As RadioButton Get Return CType(UndoRedoControl, RadioButton) End Get End Property Public Overrides Sub Undo() MyBase.Undo(UndoRedoRadioButton) Control.Checked = False If UndoRedoRadioButton IsNot Nothing Then UndoRedoRadioButton.Checked = True End If End Sub Public Overrides Sub Redo() MyBase.Redo(UndoRedoRadioButton) If UndoRedoRadioButton IsNot Nothing Then UndoRedoRadioButton.Checked = False End If Control.Checked = True End Sub Public Overrides Function CommandAsText() As String If UndoRedoRadioButton IsNot Nothing Then Return String.Format("Invert '{0}'/'{1}'", Control.Text, UndoRedoRadioButton.Text) Else Return String.Format("Change '{0}'", Control.Text) End If End Function End Class '**************************************************************************************************************** ' MonthCalendar '**************************************************************************************************************** Public Class MonthCalendarUndoRedoCommand : Inherits BaseUndoRedoCommand Protected ReadOnly Property UndoRedoSelectionRange() As SelectionRange Get Return CType(UndoRedoData, SelectionRange) End Get End Property Public Sub New(ByVal AUndoMonitor As BaseUndoRedoMonitor, ByVal AMonitorControl As Control) MyBase.New(AUndoMonitor, AMonitorControl) UndoRedoData = Control.SelectionRange End Sub Public Sub New(ByVal AUndoMonitor As BaseUndoRedoMonitor, ByVal AMonitorControl As Control, ByVal AUndoRedoData As SelectionRange) MyBase.New(AUndoMonitor, AMonitorControl, AUndoRedoData) End Sub Public ReadOnly Property Control() As MonthCalendar Get Return CType(UndoRedoControl, MonthCalendar) End Get End Property Public Overrides Sub Undo() MyBase.Undo() Control.SelectionRange = UndoRedoSelectionRange End Sub Public Overrides Sub Redo() MyBase.Redo() Control.SelectionRange = UndoRedoSelectionRange End Sub Public Overrides Function CommandAsText() As String If Date.Equals(UndoRedoSelectionRange.Start, UndoRedoSelectionRange.End) Then Return String.Format("Select date {0}", FormatDateTime(UndoRedoSelectionRange.Start, DateFormat.ShortDate)) Else End If Return String.Format("Change to '{0}'", String.Format("{0} until {1}", FormatDateTime(UndoRedoSelectionRange.Start, DateFormat.ShortDate), _ FormatDateTime(UndoRedoSelectionRange.End, DateFormat.ShortDate))) End Function End Class
2. Usarlo de esta manera: Public Class Form1 Private WithEvents frmUndoRedoManager As UndoRedoManager Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load frmUndoRedoManager = New UndoRedoManager(Me) End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click frmUndoRedoManager.Undo() End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click frmUndoRedoManager.Redo() End Sub End Class
Saludos.
|
|
|
8759
|
Informática / Software / Re: Modificar ISO.
|
en: 10 Julio 2013, 20:11 pm
|
Pocos datos. 1. ¿Que sistema operativo es? 2. ¿Es una ISO bootable? 3. ¿Como se llama el software que está grabado en la ISO? Quisiera saber si se puede modificar o no ésta ISO para que me pueda permitir elegir el lugar de destino, Una ISO no tiene lógica... quiero decir que la ISO no es quien te guarda ese backup de tu sistema, sinó el software que haya dentro de dicha ISO, y nisiquiera sabemos el nombre del software... mucho menos podemos saber si dispone de opciones para modificar los parámetros de forma desatendida... De todas formas con cualquier programa para manejar ISO's puedes modificar/extraer el contenido de una ISO... pero no sé exáctamente lo que pretendes hacer la verdad... Saludos.
|
|
|
|
|
|
|