本文整理汇总了C#中Controller类的典型用法代码示例。如果您正苦于以下问题:C# Controller类的具体用法?C# Controller怎么用?C# Controller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Controller类属于命名空间,在下文中一共展示了Controller类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configure
/// <inheritDocs/>
public void Configure(Control webFormsControl, Controller controller)
{
var formElementController = (IFormElementController<IFormElementModel>)controller;
var sectionControl = (FormSectionHeader)webFormsControl;
var sectionElementModel = (ISectionHeaderModel)formElementController.Model;
sectionElementModel.Text = sectionControl.Title;
}
示例2: Start
// Use this for initialization
void Start()
{
leap = new Controller();
for ( int i = 0; i < FingerObjects.Length; i++ ) {
FingerObjects[i].transform.localScale = new Vector3( 10, 10, 10 );
}
}
示例3: Start
void Start()
{
controller = new Controller();
_princessHasShot = false;
coolDownValue = 1.0f;
currCD = 0.0f;
}
示例4: Start
void Start()
{
leap_controller_ = new Controller();
num_active_hands_ = 0;
hands_ = new List<HandData>();
physics_hands_ = new List<HandData>();
}
示例5: BasicIPC
public void BasicIPC()
{
using (var sp = new ServiceProvider(true))
using (var p = StartProcess("payloadtest_debug.exe", "0"))
using (var c = new Controller(p.Process, sp)) {
p.WaitForText("$0");
sp.Scheduler.WaitFor(c.InjectPayload());
sp.Scheduler.WaitFor(c.WaitForPayloadReady());
sp.Scheduler.WaitFor(c.SetLogging(true));
sp.Scheduler.WaitFor(c.SetEnabled("*", true));
p.Write(" ");
p.WaitForText("$1");
p.WaitForText("marker hit: 0 'function_with_marker::marker::hit'");
p.Write(" ");
p.WaitForText("$2");
p.WaitForText("marker hit: 0 'function_with_marker::marker::hit'");
sp.Scheduler.WaitFor(c.SetEnabled("*", false));
p.Write(" ");
p.WaitForText("$3");
p.Write(" ");
p.WaitForText("$4");
p.Succeeded();
}
}
示例6: SetUp
public void SetUp()
{
ChangingHeights.Instance.eventDelegate += delegateReference;
controller = ChangingHeights.Instance.Controller;
shadowProjector.orthographicSize = ChangingHeights.Instance.size;
}
示例7: Test_View_Events_WiredUp
public void Test_View_Events_WiredUp()
{
MockRepository mocks = new MockRepository();
IView view = mocks.StrictMock<IView>();
// expect that the model is set on the view
// NOTE: if I move this Expect.Call above
// the above Expect.Call, Rhino mocks blows up on with an
// "This method has already been set to ArgsEqualExpectation."
// not sure why. Its a side issue.
Expect.Call(view.Model = Arg<Model>.Is.NotNull);
// expect the event ClickButton to be wired up
IEventRaiser clickButtonEvent =
Expect.Call(delegate
{
view.ClickButton += null;
}).IgnoreArguments().GetEventRaiser();
// Q: How do i set an expectation that checks that the controller
// correctly updates the model in the event handler.
// i.e. above we know that the controller executes
// _model.UserName = "Keith here :)"
// but how can I verify it?
// The following wont work, because Model is null:
// Expect.Call(view.Model.UserName = Arg<String>.Is.Anything);
mocks.ReplayAll();
Controller controller = new Controller(view);
clickButtonEvent.Raise(null, null);
mocks.VerifyAll();
}
示例8: Get
/// <summary>
/// Retrieve the object from dictionary
/// </summary>
/// <param name="controller"></param>
/// <param name="id"></param>
/// <returns></returns>
internal Invoicedto Get(object controller, Int64 id)
{
invoiceController = controller as System.Web.Mvc.Controller;
Dictionary<Int64, Invoicedto> invoiceRepo = invoiceController.TempData["Invoice"] as Dictionary<Int64, Invoicedto>;
invoiceController.TempData.Keep();
return invoiceRepo[id];
}
示例9: Main
public static void Main (string[] args)
{
Console.WriteLine ("Hello World!");
Model model = new Model(typeof(Demo));
model.Write<ExtModel,ExtModelField>();
Store store = new Store(typeof(Demo));
store.Write();
List list = new List(typeof(Demo));
list.Write();
Form form = new Form(typeof(Demo));
form.Write();
Controller controller = new Controller(typeof(Demo));
controller.Write();
Application app = new Application(typeof(Demo));
app.Write();
Console.WriteLine ("This is The End my friend!");
}
示例10: InvokeAction
public IActionResult InvokeAction(Controller controller, ActionDescriptor actionDescriptor)
{
/*
* Child processes that use such C run-time functions as printf() and fprintf() can behave poorly when redirected.
* The C run-time functions maintain separate IO buffers. When redirected, these buffers might not be flushed immediately after each IO call.
* As a result, the output to the redirection pipe of a printf() call or the input from a getch() call is not flushed immediately and delays, sometimes-infinite delays occur.
* This problem is avoided if the child process flushes the IO buffers after each call to a C run-time IO function.
* Only the child process can flush its C run-time IO buffers. A process can flush its C run-time IO buffers by calling the fflush() function.
*/
var methodWithIntParameter = controller.GetType()
.GetMethods()
.FirstOrDefault(x => x.Name.ToLower() == actionDescriptor.ActionName.ToLower() &&
x.GetParameters().Length == 1 &&
x.GetParameters()[0].ParameterType == typeof(string) &&
x.ReturnType == typeof(IActionResult));
if (methodWithIntParameter == null)
{
throw new HttpNotFoundException(
string.Format(
"Expected method with signature IActionResult {0}(string) in class {1}Controller",
actionDescriptor.ActionName,
actionDescriptor.ControllerName));
}
try
{
var actionResult = (IActionResult)
methodWithIntParameter.Invoke(controller, new object[] { actionDescriptor.Parameter });
return actionResult;
}
catch (TargetInvocationException ex)
{
throw ex.InnerException;
}
}
示例11: Settings
/// <summary>
/// Construct a <code>Settings</code> form with no weapon list
/// </summary>
/// <param name="uic">Calling UIController</param>
/// <param name="configReader">A configuration reader</param>
public Settings(Controller.UIController uic, ConfigReader configReader)
: this(uic, configReader, new List<string>())
{
MessageBox.Show("This is the first time you have run SANTA. Please specify the paths for the report template, database, and log file.", "First run", MessageBoxButtons.OK, MessageBoxIcon.Information);
firstRun = true;
}
示例12: BuildMethodParameters
private static object[] BuildMethodParameters(PluginManifest Manifest, Type Handler, MethodInfo methodInfo, string ActionName, Controller HostController)
{
var methodParams = methodInfo.GetParameters();
var result = new object[methodParams.Length];
for (int i = 0; i < methodParams.Length; i++)
{
var methodParam = methodParams[i];
Type parameterType = methodParam.ParameterType;
IModelBinder modelBinder = ModelBinders.Binders.GetBinder(parameterType);
IValueProvider valueProvider = HostController.ValueProvider;
string parameterName = methodParam.Name;
ModelBindingContext bindingContext = new ModelBindingContext()
{
FallbackToEmptyPrefix = true,
ModelMetadata = ModelMetadataProviders.Current.GetMetadataForType(null, parameterType),
ModelName = parameterName,
ModelState = HostController.ViewData.ModelState,
PropertyFilter = (p) => true,
ValueProvider = valueProvider
};
var parameterValue = modelBinder.BindModel(HostController.ControllerContext, bindingContext);
if (parameterValue == null && methodParam.HasDefaultValue)
parameterValue = methodParam.DefaultValue;
result[i] = parameterValue;
}
return result;
}
示例13: RenderMailMessage
/// <summary>
/// Renders the mail message.
/// </summary>
/// <param name="templateName">Name of the template.</param>
/// <param name="engineContext">The engine context.</param>
/// <param name="controller">The controller.</param>
/// <param name="doNotApplyLayout">if set to <c>true</c> [do not apply layout].</param>
/// <returns></returns>
public Message RenderMailMessage(string templateName, IRailsEngineContext engineContext, Controller controller,
bool doNotApplyLayout)
{
context.AddMailTemplateRendered(templateName, controller.PropertyBag);
return new Message("from", "to", "subject", "body");
}
示例14: HomePageServer
public HomePageServer(Controller controller, int serverAccountId)
{
InitializeComponent();
_controller = controller;
ServerAccountId = serverAccountId;
var serverAccount = Model.ServerAccounts.Get(serverAccountId);
panelSecondDeviceNotLinked.Visible = !serverAccount.LinkedDeviceSetup;
SecondDeviceSetup = serverAccount.LinkedDeviceSetup;
if (serverAccount.LinkedDeviceSetup)
{
if (serverAccount.LinkedDeviceCryptoKeyId == 0)
{
panelVerifyDeviceKeys.Visible = true;
DeviceKeysVerified = false;
}
else
{
var linkedDeviceCryptoKey = Model.CryptoKeys.Get(serverAccount.LinkedDeviceCryptoKeyId);
if (!linkedDeviceCryptoKey.Trust)
{
panelVerifyDeviceKeys.Visible = true;
DeviceKeysVerified = false;
}
else
{
panelVerifyDeviceKeys.Visible = false;
DeviceKeysVerified = true;
}
}
}
}
示例15: MultiClampDevice
/// <summary>
/// Constructs a new MultiClampDevice
/// </summary>
/// <param name="commander">MultiClampCommander instance</param>
/// <param name="c">Symphony Controller instance</param>
/// <param name="background">Dictionary of background Measurements for each MultiClamp operating mode</param>
public MultiClampDevice(IMultiClampCommander commander, Controller c, IDictionary<MultiClampInterop.OperatingMode, IMeasurement> background)
: base("Multiclamp-" + commander.SerialNumber + "-" + commander.Channel, "Molecular Devices", c)
{
InputParameters = new ConcurrentDictionary<DateTimeOffset, MultiClampParametersChangedArgs>();
OutputParameters = new ConcurrentDictionary<DateTimeOffset, MultiClampParametersChangedArgs>();
Commander = commander;
Commander.ParametersChanged += (sender, mdArgs) =>
{
log.DebugFormat("MultiClamp parameters changed. Mode = {0}, External Command Sensistivity Units = {1} Timestamp = {2}",
mdArgs.Data.OperatingMode,
mdArgs.Data.ExternalCommandSensitivityUnits,
mdArgs.TimeStamp);
if (HasBoundInputStream)
InputParameters[mdArgs.TimeStamp.ToUniversalTime()] = mdArgs;
if (HasBoundOutputStream)
{
OutputParameters[mdArgs.TimeStamp.ToUniversalTime()] = mdArgs;
foreach (var outputStream in Streams.Values.OfType<IDAQOutputStream>().Where(s => s.DAQ != null && s.DAQ.Running == false))
{
log.DebugFormat("Setting new background for stream {0}", outputStream.Name);
outputStream.ApplyBackground();
}
}
};
Backgrounds = background;
}