本文整理汇总了C#中Display类的典型用法代码示例。如果您正苦于以下问题:C# Display类的具体用法?C# Display怎么用?C# Display使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Display类属于命名空间,在下文中一共展示了Display类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public void Execute(LiteEngine engine, StringScanner s, Display display, InputCommand input, Env env)
{
var col = this.ReadCollection(engine, s);
var doc = JsonSerializer.Deserialize(s.ToString()).AsDocument;
display.WriteResult(engine.Update(col, doc));
}
示例2: ProcessRequest
/// <summary>
/// Handle a request.
/// </summary>
/// <param name="pDisplay">The display which called this function.</param>
/// <param name="pSurface">The surface which this display is hosted on.</param>
/// <param name="dArguments">A dictionary of arguments which are passed to the function as parameters.</param>
/// <returns>True if the request was processed sucessfully. False if there was an error.</returns>
public bool ProcessRequest(Display pDisplay, Surface pSurface, JSObject dArguments)
{
// Find the new surface.
var pTargetSurface = Authority.FindSurface(dArguments.GetValueOrDefault("target", ""));
if (pTargetSurface == null)
{
Log.Write("Cannot swap display to target surface. Missing valid 'target' parameter.", pDisplay.ToString(), Log.Type.DisplayWarning);
return false;
}
// Check the surface this view is on is not our target.
if (pTargetSurface == pDisplay.ActiveSurface)
{
Log.Write("Cannot swap display to target surface because it is already there.", pDisplay.ToString(), Log.Type.DisplayWarning);
return false;
}
// If the target surface has a display, get a reference and remove it.
Display pOtherView = pTargetSurface.ActiveDisplay;
if (pOtherView != null)
Authority.RemoveDisplay(pOtherView);
// Remove this display from this surface and put it on the target surface.
Authority.RemoveDisplay(pDisplay);
Authority.ShowDisplay(pDisplay, pTargetSurface);
// Now put the other display on the original surface.
if (pOtherView != null)
Authority.ShowDisplay(pOtherView, pSurface);
// Boom.
return true;
}
示例3: Auth
public static string Auth(string callbackUrl, string state, Scope scope = Scope.None, Display display = Display.Page)
{
var parameters = new List<Parameter> {
new Parameter { Name = OAuth2Parameter.ConsumerID.Value(), Value = clientId },
new Parameter { Name = OAuth2Parameter.CallbackUrl.Value(), Value = callbackUrl },
new Parameter { Name = OAuth2Parameter.State.Value(), Value = state }
};
if (display != Display.Page)
parameters.Add(new Parameter { Name = OAuth2Parameter.Display.Value(), Value = display.Value() });
if (scope != Scope.None) {
var permissionNames = new List<string>();
if ((scope & Scope.Email) == Scope.Email)
permissionNames.Add(Scope.Email.Value());
if ((scope & Scope.Birthday) == Scope.Birthday)
permissionNames.Add(Scope.Birthday.Value());
if ((scope & Scope.Publish) == Scope.Publish)
permissionNames.Add(Scope.Publish.Value());
if (permissionNames.Count > 0)
parameters.Insert(0, new Parameter { Name = OAuth2Parameter.Scope.Value(), Value = string.Join(scopeDelimiter, permissionNames) });
}
return Utils.CreateUri(AuthorizeEndpoint, parameters).AbsoluteUri;
}
示例4: CreateNewSource
//[XmlIgnore]
//[Browsable(false)]
//public override bool IsSupportPreview
//{
// get { return true; }
//}
public override Source CreateNewSource(Slide slide, ModuleConfiguration moduleConfiguration, Dictionary<string, IList<DeviceResourceDescriptor>> resources, Display display)
{
//IEDocumentSourceDesign source = new IEDocumentSourceDesign() { Type = this };
//return source;
return new IEDocumentSourceDesign { Type = this };
}
示例5: Main
static void Main()
{
DateTime date1 = new DateTime(2013, 5, 24, 11, 11, 30);
DateTime date2 = new DateTime(2013, 5, 24, 15, 23, 2);
DateTime date3 = new DateTime(2013, 5, 31, 9, 00, 00);
DateTime date4 = new DateTime(2013, 5, 31, 18, 12, 20);
Call call1 = new Call(date1, "0888313233", 850);
Call call2 = new Call(date2, "0888909090", 95);
Call call3 = new Call(date3, "0889556677", 213);
Call call4 = new Call(date4, "0888313233", 37);
Battery battery = new Battery ("PX8", BatteryType.LiIon, 300, 8);
Display display = new Display(4, 16000000);
GSM gsm = new GSM("I900", "Samsung", 500, "Me", battery, display);
gsm.AddCalls(call1);
gsm.AddCalls(call2);
gsm.AddCalls(call3);
gsm.AddCalls(call4);
foreach (var call in gsm.CallHistory)
{
Console.WriteLine(call);
}
Console.WriteLine("Total amount to pay: {0:C}",gsm.TotalCallsPrice);
gsm.DeleteCalls(call1);
Console.WriteLine("Total amount to pay: {0:C}", gsm.TotalCallsPrice);
gsm.ClearHistory();
Console.WriteLine("Total amount to pay: {0:C}", gsm.TotalCallsPrice);
}
示例6: Main
static void Main(string[] args)
{
var display = new Display(Console.Out, Console.In);
var problemLoader = new ProblemLoader(display);
bool exit = false;
while (!exit)
{
display.Write("Enter Problem Number ('q' to quit): ");
var input = display.ReadLine();
if (input == "q")
{
exit = true;
continue;
}
try
{
int problemNumber = int.Parse(input);
var problem = problemLoader.LoadProblem(problemNumber);
problem.Run();
}
catch (Exception)
{
display.WriteLine("Problem Solution does not exist for {0}.", input);
}
}
}
示例7: Main
private static void Main()
{
// Generate some test batteries and displays
var premiumDisplay = new Display(4.5, Display.ColorDepth._32Bit);
var mediocreDisplay = new Display(3.5, Display.ColorDepth._16Bit);
var poorDisplay = new Display(2.5, Display.ColorDepth._8bit);
var premiumBattery = new Battery("Sanyo-SN532e", 120, 20, Battery.Type.LiPol);
var mediocreBattery = new Battery("Shanzungmang-2341", 80, 15, Battery.Type.LiIon);
var poorBattery = new Battery("Mistucura-1224fe", 40, 5, Battery.Type.NiMH);
// initilize gsms in the array
var gsmArray = new GSM[4];
gsmArray[0] = new GSM("One", "HTC", "Kiro", premiumDisplay, premiumBattery, 200);
gsmArray[1] = new GSM("Blade", "Zte");
gsmArray[2] = new GSM("Galaxy S4", "Samsung", "Misho", premiumDisplay, mediocreBattery, 1000);
gsmArray[3] = new GSM("Ascend G600", "Huawei", "Mtel", premiumDisplay,
new Battery("Toshiba-tbsae", 380, 6, Battery.Type.LiPol), 600);
// print the gsms
foreach (var phone in gsmArray)
{
Console.WriteLine(phone);
}
// print the static property Iphone4S
Console.WriteLine(GSM.Iphone4S);
// test GsmCallHistory
GSMCallHistoryTest.Test();
}
示例8: ProcessRequest
/// <summary>
/// Handle a request.
/// </summary>
/// <param name="pDisplay">The display which called this function.</param>
/// <param name="pSurface">The surface which this display is hosted on.</param>
/// <param name="dArguments">A dictionary of arguments which are passed to the function as parameters.</param>
/// <returns>True if the request was processed sucessfully. False if there was an error.</returns>
public bool ProcessRequest(Display pDisplay, Surface pSurface, JSObject dArguments)
{
// Check we have a sound file.
var sSound = dArguments.GetValueOrDefault("file", "");
if (sSound == null || sSound == "")
{
Log.Write("Cannot play sound. Are you missing a 'file' parameter.", pDisplay.ToString(), Log.Type.DisplayWarning);
return false;
}
// Attempt to play it.
try
{
SoundPlayer pSound = new SoundPlayer(sSound);
pSound.Play();
return true;
}
// Log warnings.
catch (Exception e)
{
Log.Write("Cannot play sound. " + e.Message, pDisplay.ToString(), Log.Type.DisplayWarning);
return false;
}
}
示例9: Execute
public override void Execute(LiteShell shell, StringScanner s, Display display, InputCommand input)
{
if(s.Scan("false|off").Length > 0 && _writer != null)
{
display.TextWriters.Remove(_writer);
input.OnWrite = null;
_writer.Flush();
_writer.Dispose();
_writer = null;
}
else if(_writer == null)
{
if (shell.Database == null) throw LiteException.NoDatabase();
var dbfilename = shell.Database.ConnectionString.Filename;
var path = Path.Combine(Path.GetDirectoryName(dbfilename),
string.Format("{0}-spool-{1:yyyy-MM-dd-HH-mm}.txt", Path.GetFileNameWithoutExtension(dbfilename), DateTime.Now));
_writer = File.CreateText(path);
display.TextWriters.Add(_writer);
input.OnWrite = (t) => _writer.Write(t);
}
}
示例10: Execute
public override bool Execute()
{
Image image = null;
if (File.Exists(_path))
{
image = Image.Load(RunMode.Noninteractive, _path, _path);
}
else
{
var choose = new FileChooserDialog("Open...",
null,
FileChooserAction.Open,
"Cancel", ResponseType.Cancel,
"Open", ResponseType.Accept);
if (choose.Run() == (int) ResponseType.Accept)
{
string fileName = choose.Filename;
image = Image.Load(RunMode.Noninteractive, fileName, fileName);
};
choose.Destroy();
}
if (image != null)
{
image.CleanAll();
ActiveDisplay = new Display(image);
ActiveImage = image;
return true;
}
return false;
}
示例11: Execute
public void Execute(LiteEngine engine, StringScanner s, Display display, InputCommand input, Env env)
{
var col = this.ReadCollection(engine, s);
var index = s.Scan(this.FieldPattern).Trim();
display.WriteResult(engine.Max(col, index.Length == 0 ? "_id" : index));
}
示例12: SlideLayout
public SlideLayout(IEnumerable<Display> ADisplays, Slide ASlide)
{
m_slide = ASlide;
m_displays = new List<Display>();
foreach (Display d in ADisplays)
{
if (!WeContainDisplay(d))
{
AddDisplayToSlide(d);
}
else
{
m_displays.Add(FindDisplay(d));
}
}
if (m_displays.Count > 0)
{
m_windowList = new List<Window>(m_displays[0].WindowList);
firstDisplay = m_displays.First();
}
else
m_windowList = new List<Window>();
UpdateDisplayLayout();
}
示例13: Main
static void Main()
{
GSM[] mobilePhones = new GSM[3];
GSM nokia = new GSM("3310", "Nokia");
nokia.AddHistory(DateTime.Now, 0998080907, 1.08);
nokia.AddHistory(DateTime.Now, 0998080907, 2132331.08);
nokia.DeleteHistory(1);
Battery sonyBattery5511 = new Battery("77ds7", 220, 10, BatteryType.NiMH);
Display sonyDisplay5511 = new Display(23, 128);
GSM sony = new GSM("5511", "Sony", 100.77m, "Pesho", sonyBattery5511, sonyDisplay5511);
GSM samsung = new GSM("4433", "samsung", 50.22m, "Gosho");
mobilePhones[0] = nokia;
mobilePhones[1] = sony;
mobilePhones[2] = samsung;
//Console.WriteLine(nokia.CalcPriceHistory(2.2m));
for (int i = 0; i < mobilePhones.Length; i++)
{
Console.WriteLine(mobilePhones[i]);
}
}
示例14: Main
static void Main()
{
GSM gsm = new GSM("nokia", "nokiaman");
GSM gsm1 = new GSM("nokia", "nok", 9.5m);
Battery bat = new Battery("monbat", 500, 100, BatteryType.NiMH);
Display dis = new Display(null, 256);
GSM gsm2 = new GSM("erik", "erik", bat);
GSM gsm3 = new GSM("koko", "ka", dis);
Console.WriteLine(gsm.ToString());
Console.WriteLine("-----");
Console.WriteLine(gsm1.ToString());
Console.WriteLine("-----");
Console.WriteLine(gsm2.ToString());
Console.WriteLine("-----");
Console.WriteLine(gsm3.ToString());
Console.WriteLine("---------------------------");
GSM p = GSM.IPhone4S;
p.Owner = "pesho";
p.Battery = bat;
Console.WriteLine(p.ToString());
GSMCallHistoryTest.Test();
}
示例15: Configure
public override void Configure(Display.ChartComponent[] components_)
{
reset(components_);
setComponent(components_[0], CTDValuePair.TY, 2d);
setComponent(components_[1], CTDValuePair.CT5, -1d);
setComponent(components_[2], CTDValuePair.CT10, -1d);
}