本文整理汇总了C#中System.Switch类的典型用法代码示例。如果您正苦于以下问题:C# Switch类的具体用法?C# Switch怎么用?C# Switch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Switch类属于System命名空间,在下文中一共展示了Switch类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: eliminarValoresTabla
public static EstadoOperacion eliminarValoresTabla(string tabla,
int Id)
{
string query = "delete from " + tabla + " where ID=" + Id.ToString();
try
{
using (Switch contexto = new Switch())
{
DbCommand Comando = contexto.CreateCommand(query, CommandType.Text);
using (contexto.CreateConeccionScope())
{
if (Comando.ExecuteNonQuery() != 1)
{
return new EstadoOperacion(false, null, null);
}
return new EstadoOperacion(true, null, null);
}
}
}
catch (Exception e)
{
return new EstadoOperacion(false, e.Message, e);
}
}
示例2: eliminarMensajeTransaccional
public static EstadoOperacion eliminarMensajeTransaccional(MENSAJE_TRANSACCIONAL MensajeTransaccional)
{
DbFactory Factoria = DataAccessFactory.ObtenerProveedor();
try
{
using (Switch contexto = new Switch())
{
using (contexto.CreateConeccionScope())
{
string query =
"DELETE FROM MENSAJE_TRANSACCIONAL" +
" WHERE MTR_CODIGO = @codigo";
DbCommand Comando = contexto.CreateCommand(query, CommandType.Text);
Comando.Parameters.Add(Factoria.CrearParametro("@codigo", MensajeTransaccional.MTR_CODIGO));
if (Comando.ExecuteNonQuery() != 1)
{
return new EstadoOperacion(false, null, null);
}
return new EstadoOperacion(true, null, null);
}
}
}
catch (Exception e)
{
return new EstadoOperacion(false, e.Message, e);
}
}
示例3: eliminarTabla
public static EstadoOperacion eliminarTabla(TABLA tabla)
{
DbFactory Factoria = DataAccessFactory.ObtenerProveedor();
try
{
using (Switch contexto = new Switch())
{
using (contexto.CreateConeccionScope())
{
string query = "EliminarTabla";
DbCommand Comando = contexto.CreateCommand(query, CommandType.StoredProcedure);
Comando.Parameters.Add(Factoria.CrearParametro("@codigo", tabla.TBL_CODIGO));
if (Comando.ExecuteNonQuery() != 1)
{
return new EstadoOperacion(false, null, null);
}
return new EstadoOperacion(true, null, null);
}
}
}
catch (DbException dbex)
{
return new EstadoOperacion(false, dbex.Message, dbex);
}
catch (Exception e)
{
return new EstadoOperacion(false, e.Message, e);
}
}
示例4: eliminarCriptografiaCampo
public static EstadoOperacion eliminarCriptografiaCampo(CRIPTOGRAFIA_CAMPO CriptografiaCampo)
{
try
{
DbFactory Factoria = DataAccessFactory.ObtenerProveedor();
using (Switch contexto = new Switch())
{
using (contexto.CreateConeccionScope())
{
string query =
"DELETE FROM CRIPTOGRAFIA_CAMPO" +
" WHERE CRC_CODIGO [email protected];";
DbCommand Comando = contexto.CreateCommand(query, CommandType.Text);
Comando.Parameters.Add(Factoria.CrearParametro("@codigo", CriptografiaCampo.CRC_CODIGO));
if (Comando.ExecuteNonQuery() != 1)
{
return new EstadoOperacion(false, null, null);
}
return new EstadoOperacion(true, null, null);
}
}
}
catch (Exception e)
{
return new EstadoOperacion(false, e.Message, e);
}
}
示例5: eliminarTransformacion
public static EstadoOperacion eliminarTransformacion(TRANSFORMACION Transformacion)
{
try
{
using (Switch contexto = new Switch())
{
using (contexto.CreateConeccionScope())
{
string query =
"DELETE FROM TRANSFORMACION" +
" WHERE TRM_CODIGO = @codigo";
DbCommand Comando = contexto.CreateCommand(query, CommandType.Text);
Comando.Parameters.Add(Factoria.CrearParametro("@codigo", Transformacion.TRM_CODIGO));
if (Comando.ExecuteNonQuery() != 1)
{
return new EstadoOperacion(false, null, null);
}
return new EstadoOperacion(true, null, null);
}
}
}
catch (Exception e)
{
return new EstadoOperacion(false, e.Message, e);
}
}
示例6: eliminarTransformacionCampo
public static EstadoOperacion eliminarTransformacionCampo(TRANSFORMACION_CAMPO transformacionCampo)
{
DbFactory Factoria = DataAccessFactory.ObtenerProveedor();
try
{
using (Switch contexto = new Switch())
{
using (contexto.CreateConeccionScope())
{
string query =
"DELETE FROM TRANSFORMACION_CAMPO" +
" WHERE [email protected]_codigo" +
" AND [email protected]_codigo" +
" AND [email protected]_codigo";
DbCommand Comando = contexto.CreateCommand(query, CommandType.Text);
Comando.Parameters.Add(Factoria.CrearParametro("@transformacion_codigo", transformacionCampo.TRM_CODIGO));
Comando.Parameters.Add(Factoria.CrearParametro("@campoDestino_codigo", transformacionCampo.CAM_CODIGO_CAMPO_DESTINO));
Comando.Parameters.Add(Factoria.CrearParametro("@mensajeDestino_codigo", transformacionCampo.MEN_CODIGO_MENSAJE_DESTINO));
if (Comando.ExecuteNonQuery() != 1)
{
return new EstadoOperacion(false, null, null);
}
return new EstadoOperacion(true, null, null);
}
}
}
catch (Exception e)
{
return new EstadoOperacion(false, e.Message, e);
}
}
示例7: FormFuzzy
public FormFuzzy()
{
InitializeComponent();
comboBoxDelay.SelectedIndex = 0;
mySwitch += MotionDown;
mySwitch += MotionUp;
gr = new Randare(pictureBox1.Width, pictureBox1.Height, 0, 100, 1, 25);
pos1 = pictureBox1.Location;
pos2 = pictureBox2.Location;
size1 = pictureBox1.Size;
size2 = pictureBox1.Size;
try
{
A = new NumarFuzzy(Convert.ToInt32(textBoxCentruA.Text), Convert.ToInt32(textBoxAlfaA.Text), Convert.ToInt32(textBoxBetaA.Text), gr.Max);
B = new NumarFuzzy(Convert.ToInt32(textBoxCentruB.Text), Convert.ToInt32(textBoxAlfaB.Text), Convert.ToInt32(textBoxBetaB.Text), gr.Max);
alfa = Convert.ToDouble(textBoxAlfa.Text);
if (alfa < 0 || alfa > 1)
throw new Exception();
pictureBox1.Refresh();
pictureBox2.Refresh();
ValidareButoane(true);
}
catch
{
MessageBox.Show("Date gresite !");
A = null;
B = null;
}
}
示例8: insertarColumna
public static EstadoOperacion insertarColumna(COLUMNA Columna)
{
try
{
using (Switch contexto = new Switch())
{
using (contexto.CreateConeccionScope())
{
Columna.COL_CODIGO = 0;
string query = "InsertarColumna";
DbCommand Comando = crearComando(contexto, Columna, query);
if (Comando.ExecuteNonQuery() != 1)
{
return new EstadoOperacion(false, null, null);
}
return new EstadoOperacion(true, null, null);
}
}
}
catch (DbException ex)
{
return new EstadoOperacion(false, ex.Message, ex, false);
}
catch (Exception e)
{
return new EstadoOperacion(false, e.Message, e);
}
}
示例9: SetPeripheralState
public static void SetPeripheralState(Peripheral device, Switch state)
{
portState = state == Switch.On ? true : false;
switch (device) {
case Peripheral.Ethernet:
if (peripheralPorts[0] == null)
peripheralPorts[0] = new OutputPort((Cpu.Pin)Peripheral.Ethernet, !portState);
else
peripheralPorts[0].Write(!portState);
break;
case Peripheral.PowerLED:
if (peripheralPorts[1] == null)
peripheralPorts[1] = new OutputPort((Cpu.Pin)Peripheral.PowerLED, portState);
else
peripheralPorts[1].Write(portState);
break;
case Peripheral.SDCard:
if (peripheralPorts[2] == null)
peripheralPorts[2] = new OutputPort((Cpu.Pin)Peripheral.SDCard, portState);
else
peripheralPorts[2].Write(portState);
break;
case Peripheral.PowerHeaders:
if (peripheralPorts[3] == null)
peripheralPorts[3] = new OutputPort((Cpu.Pin)Peripheral.PowerHeaders, portState);
else
peripheralPorts[3].Write(portState);
break;
default:
throw new ArgumentOutOfRangeException("device");
}
}
示例10: eliminarValidacionCampo
public static EstadoOperacion eliminarValidacionCampo(VALIDACION_CAMPO vcampo)
{
DbFactory Factoria = DataAccessFactory.ObtenerProveedor();
try
{
using (Switch contexto = new Switch())
{
using (contexto.CreateConeccionScope())
{
string query = "DELETE FROM [VALIDACON_CAMPO] " +
"WHERE [VLC_CODIGO] = @codigo";
DbCommand Comando = contexto.CreateCommand(query, CommandType.Text);
Comando.Parameters.Add(Factoria.CrearParametro("@codigo", vcampo.VLC_CODIGO));
if (Comando.ExecuteNonQuery() != 1)
{
return new EstadoOperacion(false, null, null);
}
return new EstadoOperacion(true, null, null);
}
}
}
catch (Exception e)
{
return new EstadoOperacion(false, e.Message, e);
}
}
示例11: Init
protected override void Init ()
{
var layout = new StackLayout ();
var button = new Button { Text = "Click" };
var tablesection = new TableSection { Title = "Switches" };
var tableview = new TableView { Intent = TableIntent.Form, Root = new TableRoot { tablesection } };
var viewcell1 = new ViewCell {
View = new StackLayout {
HorizontalOptions = LayoutOptions.FillAndExpand,
Orientation = StackOrientation.Horizontal,
Children = {
new Label { Text = "Switch 1", HorizontalOptions = LayoutOptions.StartAndExpand },
new Switch { AutomationId = "switch1", HorizontalOptions = LayoutOptions.End, IsToggled = true }
}
}
};
var viewcell2 = new ViewCell {
View = new StackLayout {
HorizontalOptions = LayoutOptions.FillAndExpand,
Orientation = StackOrientation.Horizontal,
Children = {
new Label { Text = "Switch 2", HorizontalOptions = LayoutOptions.StartAndExpand },
new Switch { AutomationId = "switch2", HorizontalOptions = LayoutOptions.End, IsToggled = true }
}
}
};
Label label = new Label { Text = "Switch 3", HorizontalOptions = LayoutOptions.StartAndExpand };
Switch switchie = new Switch { AutomationId = "switch3", HorizontalOptions = LayoutOptions.End, IsToggled = true, IsEnabled = false };
switchie.Toggled += (sender, e) => {
label.Text = "FAIL";
};
var viewcell3 = new ViewCell {
View = new StackLayout {
HorizontalOptions = LayoutOptions.FillAndExpand,
Orientation = StackOrientation.Horizontal,
Children = {
label,
switchie,
}
}
};
tablesection.Add (viewcell1);
tablesection.Add (viewcell2);
tablesection.Add (viewcell3);
button.Clicked += (sender, e) => {
if (_removed)
tablesection.Insert (1, viewcell2);
else
tablesection.Remove (viewcell2);
_removed = !_removed;
};
layout.Children.Add (button);
layout.Children.Add (tableview);
Content = layout;
}
示例12: obtenerMensajeTransaccional
public static List<REGLA_MENSAJE_TRANSACCIONAL> obtenerMensajeTransaccional()
{
using (Switch contexto = new Switch())
{
contexto.REGLA_MENSAJE_TRANSACCIONAL.MergeOption = MergeOption.NoTracking;
return contexto.REGLA_MENSAJE_TRANSACCIONAL.ToList<REGLA_MENSAJE_TRANSACCIONAL>();
}
}
示例13: StagedDeployTarget
public StagedDeployTarget(string name, Parameter<string> stage)
{
Name = name;
Stage = stage;
Switch = new Switch<string>(stage);
PrepareDeploy = package => package;
InvokeRemoteDeploy = package => package;
Deploy = package => package;
}
示例14: CreateLevel0
private static Level CreateLevel0()
{
Level lvl = new Level();
lvl.Gravity = 9.80f;
lvl.InitialPosition = new Vector2(0, -500);
lvl.AssetName = "Level0";
lvl.LevelIdentifier = 0;
lvl.Tiles.Add(new Tile(new Rectangle(778, 0, 186, 281), Surface.Absorbs));
lvl.Tiles.Add(new Tile(new Rectangle(964, 0, 420, 195), Surface.Normal));
lvl.Tiles.Add(new Tile(new Rectangle(0, 473, 301, 151), Surface.Absorbs));
lvl.Tiles.Add(new Tile(new Rectangle(301, 473, 411, 151), Surface.Normal));
lvl.Tiles.Add(new Tile(new Rectangle(711, 473, 569, 151), Surface.Amplifies));
lvl.Tiles.Add(new Tile(new Rectangle(0, 1500 - 364, 216, 364), Surface.Absorbs));
lvl.Tiles.Add(new Tile(new Rectangle(216, 1500 - 364, 240, 364), Surface.Normal));
lvl.Tiles.Add(new Tile(new Rectangle(456, 1500 - 364, 216, 364), Surface.Absorbs));
lvl.Tiles.Add(new Tile(new Rectangle(672, 1500 - 364, 159, 364), Surface.Normal));
lvl.Tiles.Add(new Tile(new Rectangle(0, 966, 216, 170), Surface.Normal));
lvl.Tiles.Add(new Tile(new Rectangle(456, 966, 215, 170), Surface.Normal));
lvl.Tiles.Add(new Tile(new Rectangle(936, 1500 - 421, 485, 421), Surface.Reflects));
lvl.Tiles.Add(new Tile(new Rectangle(1718, 915, 282, 585), Surface.Absorbs));
lvl.Checkpoints.Add(new Checkpoint(270, 1136 - 134, 0, 0, 4));
lvl.Checkpoints.Add(new Checkpoint(680, 1136 - 134, 680, 1024, 1));
lvl.Checkpoints.Add(new Checkpoint(1180, 1079 - 134, 1180, 1500, 1));
lvl.Checkpoints.Add(new Checkpoint(1165, 473 - 134, 1275, 473, 2));
lvl.Checkpoints.Add(new Checkpoint(75, 473 - 134, 100, 473, 2));
Switch switch1 = new Switch(System.Guid.NewGuid(), new Vector2(1980, 815), Switch.SwitchState.Active);
switch1.Actions.Add(new KeyValuePair<Guid, int>(Character.CharacterGuid, (int)Switch.SwitchState.Pressed));
lvl.Obstacles.Add(switch1);
Platform pf1 = new Platform(System.Guid.NewGuid(), new List<Vector2>() { new Vector2(1435, 1078), new Vector2(1607, 1078), new Vector2(1607, 473), new Vector2(1286, 473) }, 50, Platform.PlatformState.Forward);
pf1.Actions.Add(new KeyValuePair<Guid, int>(switch1.Guid, (int)Platform.PlatformState.Startionary));
lvl.Obstacles.Add(pf1);
Door d1 = new Door(System.Guid.NewGuid(), new Vector2(778, 282), Door.DoorState.Stationary);
d1.Actions.Add(new KeyValuePair<Guid, int>(switch1.Guid, (int)Door.DoorState.Opening));
lvl.Obstacles.Add(d1);
Enemy e1 = new Enemy(new Vector2(370, 472), 300);
lvl.Actors.Add(e1);
//Boundaries
lvl.Tiles.Add(new Tile(new Rectangle(0, 1500 - 2, 2000, 2), Surface.Death));
lvl.Tiles.Add(new Tile(new Rectangle(0, 0, 1500, 2), Surface.Absorbs));
lvl.Tiles.Add(new Tile(new Rectangle(0, 0, 2, 2000), Surface.Absorbs));
lvl.Tiles.Add(new Tile(new Rectangle(2000 - 2, 0, 2, 1500), Surface.Absorbs));
return lvl;
}
示例15: insertarParametroTransformacionCampo
public static EstadoOperacion insertarParametroTransformacionCampo(PARAMETRO_TRANSFORMACION_CAMPO parametroTransformacionCampo)
{
try
{
using (Switch contexto = new Switch())
{
using (contexto.CreateConeccionScope())
{
parametroTransformacionCampo.PTC_CODIGO = (from c in contexto.PARAMETRO_TRANSFORMACION_CAMPO
orderby c.PTC_CODIGO descending
select c.PTC_CODIGO).FirstOrDefault() + 1;
string query =
"INSERT INTO PARAMETRO_TRANSFORMACION_CAMPO" +
"(PTC_CODIGO" +
",TRM_CODIGO" +
",CAM_CODIGO_CAMPO_DESTINO" +
",MEN_CODIGO_MENSAJE_DESTINO" +
",CAM_CODIGO_CAMPO_ORIGEN" +
",MEN_CODIGO_MENSAJE_ORIGEN" +
",PTC_POSICION_INICIAL" +
",PTC_LONGITUD" +
",TBL_CODIGO" +
",COL_CODIGO_ORIGEN" +
",COL_CODIGO_DESTINO" +
",PTC_TIPO)" +
"VALUES" +
"(@codigo" +
",@transformacion_codigo" +
",@campoDestino_codigo" +
",@mensajeDestino_codigo" +
",@campoOrigen_codigo" +
",@mensajeOrigen_codigo" +
",@posicionInicial" +
",@longitud" +
",@tabla" +
",@columnaOrigen_codigo" +
",@columnaDestino_codigo" +
",@tipoParametroTransformacionCampo_codigo)";
DbCommand Comando = crearComando(contexto, parametroTransformacionCampo, query);
if (Comando.ExecuteNonQuery() != 1)
{
return new EstadoOperacion(false, null, null);
}
return new EstadoOperacion(true, null, null);
}
}
}
catch (Exception e)
{
return new EstadoOperacion(false, e.Message, e);
}
}