コード例 #1
0
ファイル: TodoAppTests.cs プロジェクト: EricBlack/White
        public void Automate()
        {
            var workConfiguration =
                new WorkConfiguration
                {
                    ArchiveLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                    Name = "WpfTodo"
                };

            using (var workSession = new WorkSession(workConfiguration, new NullWorkEnvironment()))
            {
                var screenRepository = workSession.Attach(Application);
                var mainWindow = screenRepository.Get<TodoWindow>("Wpf Todo", InitializeOption.NoCache);
                var newTaskScreen = mainWindow.NewTask();

                const string title = "Write some tests";
                newTaskScreen.Title = title;
                newTaskScreen.Description = "for White";
                newTaskScreen.DueDate = DateTime.Now.AddDays(3);

                newTaskScreen.Create();

                var tasks = mainWindow.Tasks.ToList();
                Assert.Equal(1, tasks.Count);
                Assert.Equal(title, tasks[0].Title);
            }
        }
コード例 #2
0
ファイル: TodoAppTests.cs プロジェクト: Rallenkov/White
        public void AutomateTest()
        {
            var workPath = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).AbsolutePath);
            var workConfiguration = new WorkConfiguration
            {
                ArchiveLocation = workPath,
                Name = "WpfTodo"
            };

            CoreAppXmlConfiguration.Instance.WorkSessionLocation = new DirectoryInfo(workPath);
            using (var workSession = new WorkSession(workConfiguration, new NullWorkEnvironment()))
            {
                var screenRepository = workSession.Attach(Application);
                var mainWindow = screenRepository.Get<TodoWindow>("Wpf Todo", InitializeOption.NoCache);
                var newTaskScreen = mainWindow.NewTask();

                const string title = "Write some tests";
                newTaskScreen.Title = title;
                newTaskScreen.Description = "for White";
                newTaskScreen.DueDate = DateTime.Now.AddDays(3);

                newTaskScreen.Create();

                var tasks = mainWindow.Tasks.ToList();
                Assert.That(tasks, Has.Count.EqualTo(1));
                Assert.That(tasks[0].Title, Is.EqualTo(title));
            }
        }
コード例 #3
0
 private async Task TryApplySignatureHelpAsync(WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken, SignatureHelpTriggerInfoData trigger)
 {
     foreach (var provider in session.Roslyn.SignatureHelpProviders)
     {
         if (await TryApplySignatureHelpAsync(provider, trigger, session, sender, cancellationToken).ConfigureAwait(false))
         {
             return;
         }
     }
 }
コード例 #4
0
        private MirrorSharpTestDriver(MirrorSharpOptions?options = null, MirrorSharpServices?services = null, string languageName = LanguageNames.CSharp)
        {
            options ??= DefaultOptions;
            services ??= DefaultServices;

            var language = GetLanguageManager(options).GetLanguage(languageName);

            _middleware = new TestMiddleware(options, services);
            Session     = new WorkSession(language, options);
        }
        public ActionResult Create([Bind(Include = "NoteID,EmpID,DateTime,Title,Comment")] Note note, [Bind(Include = "CustomerPlayWith, Sold")] Work work)
        {
            if (!ModelState.IsValid)
            {
                WorkSession ws = new WorkSession
                {
                    note = note,
                    work = work
                };
                return(View(ws));
            }

            string          currentUserId = User.Identity.GetUserId();
            ApplicationUser currentUser   = (db.Users.Include(r => r.Employee).Include(r => r.Employee.Campaigns).FirstOrDefault(x => x.Id == currentUserId));

            int empID      = currentUser.Employee.EmpID;
            var currentCam = currentUser.GetTodaysCampaign();

            note.EmpID = empID;
            work.EmpID = empID;

            if (currentCam == null)
            {
                work.CamID = 0;
            }
            else
            {
                int camID = currentCam.CamID;
                work.CamID = camID;

                var existingWork = db.Works.Where(s => s.Date == work.Date && s.EmpID == work.EmpID && s.CamID == work.CamID);

                if (existingWork.Count() > 0)
                {
                    db.Entry(existingWork.First()).State = EntityState.Modified;
                    existingWork.First().CustomerPlayWith += work.CustomerPlayWith;
                    existingWork.First().Sold             += work.Sold;
                }
                else
                {
                    db.Works.Add(work);
                }
                db.Entry(currentUser.Employee).State = EntityState.Modified;
                currentUser.Employee.DecksOnHand    -= work.Sold;
            }

            if (!String.IsNullOrWhiteSpace(note.Title) || !String.IsNullOrWhiteSpace(note.Comment))
            {
                db.Notes.Add(note);
            }

            db.SaveChanges();

            return(Redirect("/home"));
        }
コード例 #6
0
        public Task ExecuteAsync(AsyncData data, WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken)
        {
            if (!session.IsRoslyn)
            {
                return(Task.CompletedTask);
            }

            var cursorPosition = FastConvert.Utf8ByteArrayToInt32(data.GetFirst());

            return(ExecuteForRoslynAsync(cursorPosition, session, sender, cancellationToken));
        }
コード例 #7
0
    protected override void OnStartWork(Worker worker)
    {
        base.OnStartWork(worker);
        Pickupable.PickupableStartWorkInfo pickupableStartWorkInfo = (Pickupable.PickupableStartWorkInfo)worker.startWorkInfo;
        float   amount  = pickupableStartWorkInfo.amount;
        Element element = pickupableStartWorkInfo.originalPickupable.GetComponent <PrimaryElement>().Element;

        session = new WorkSession(Grid.PosToCell(this), element.id, pickupableStartWorkInfo.originalPickupable.GetComponent <SubstanceChunk>(), amount, base.gameObject);
        meter.SetPositionPercent(0f);
        meter.SetSymbolTint(new KAnimHashedString("meter_target"), element.substance.colour);
    }
コード例 #8
0
ファイル: WorkSessionTest.cs プロジェクト: yonglehou/White
 public void ShouldSaveWindowInformationInFile()
 {
     File.Delete("foo.xml");
     using (WorkSession workSession = WorkSession())
     {
         Application application = new WinformsTestConfiguration().LaunchApplication();
         workSession.Attach(application);
         Window window = application.GetWindow("MainWindow", InitializeOption.NoCache.AndIdentifiedBy("foo"));
         window.Get <Button>("ButtonWithTooltip");
     }
     Assert.True(File.Exists("foo.xml"));
 }
コード例 #9
0
ファイル: WorkSessionTest.cs プロジェクト: vinaybanavsi/White
 public void ShouldSaveWindowInformationInFile()
 {
     File.Delete("foo.xml");
     using (WorkSession workSession = WorkSession())
     {
         Application application = Application.Launch(TestConfiguration.WinFormsTestAppLocation);
         workSession.Attach(application);
         Window window = application.GetWindow("Form1", InitializeOption.NoCache.AndIdentifiedBy("foo"));
         window.Get <Button>("buton");
     }
     Assert.AreEqual(true, File.Exists("foo.xml"));
 }
コード例 #10
0
    protected override void OnStopWork(Worker worker)
    {
        base.OnStopWork(worker);
        if (session != null)
        {
            session.Cleanup();
            session = null;
        }
        KAnimControllerBase component = GetComponent <KAnimControllerBase>();

        component.Play("on", KAnim.PlayMode.Once, 1f, 0f);
    }
コード例 #11
0
        public Task ExecuteAsync(AsyncData data, WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken)
        {
            var @char = FastConvert.Utf8ByteArrayToChar(data.GetFirst());

            if (@char != 'F')
            {
                // ReSharper disable once HeapView.BoxingAllocation
                throw new FormatException($"Unknown SignatureHelp command '{@char}'.");
            }

            return(_signatureHelp.ForceSignatureHelpAsync(session, sender, cancellationToken));
        }
コード例 #12
0
        private async Task TriggerCompletionAsync(WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken, CompletionTrigger trigger)
        {
            var completionList = await session.LanguageSession.GetCompletionsAsync(session.CursorPosition, trigger, cancellationToken : cancellationToken).ConfigureAwait(false);

            if (completionList == null)
            {
                return;
            }

            session.CurrentCompletion.ResetPending();
            session.CurrentCompletion.List = completionList;
            await SendCompletionListAsync(completionList, sender, cancellationToken).ConfigureAwait(false);
        }
コード例 #13
0
        public async Task <IActionResult> Edit(int id, [Bind("WorkSessionId,ContractId,DateWorked,ConsultantId,HoursWorked,WorkDescription,HourlyRate,ProvincialTax,TotalChargeBeforeTax")] WorkSession workSession)
        {
            if (id != workSession.WorkSessionId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    string ContractID = String.Empty;
                    if (Request.Cookies["ContractID"] != null)
                    {
                        ContractID = Request.Cookies["ContractID"].ToString();
                    }
                    else if (HttpContext.Session.GetString("ContactID") != null)
                    {
                        ContractID = HttpContext.Session.GetString("ContractID");
                    }
                    ViewBag.Contract = ContractID;
                    _context.Update(workSession);
                    await _context.SaveChangesAsync();

                    TempData["message"] = "Worksession Edited " + workSession.ContractId;
                    return(RedirectToAction(nameof(Index)));
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WorkSessionExists(workSession.WorkSessionId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.GetBaseException().Message);
                    TempData["message"] = ex.GetBaseException().Message;
                }
            }
            ViewData["ConsultantId"] = new SelectList(_context.Consultant, "ConsultantId", "FirstName", workSession.ConsultantId);
            ViewData["ContractId"]   = new SelectList(_context.Contract, "ContractId", "Name", workSession.ContractId);
            ViewBag.Contract         = workSession.ContractId;
            return(View(workSession));
        }
コード例 #14
0
        private static TextChange ReplaceIncompleteText(WorkSession session, CompletionList completionList, TextChange textChange)
        {
            var completionSpan = completionList.Span;

            if (session.CursorPosition <= completionSpan.Start)
            {
                return(textChange);
            }

            var span      = textChange.Span;
            var newStart  = Math.Min(span.Start, completionSpan.Start);
            var newLength = Math.Max(span.End, session.CursorPosition) - newStart;

            return(new TextChange(new TextSpan(newStart, newLength), textChange.NewText));
        }
コード例 #15
0
 public WorkSession UpdatetWorkSession(WorkSession workSession)
 {
     try
     {
         workSession.LastEditedDateTime = DateTime.UtcNow;
         DbContext.WorkSessions.Update(workSession);
         DbContext.SaveChanges();
         return(workSession);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(null);
     }
 }
        public ActionResult Create()
        {
            string          currentUserId = User.Identity.GetUserId();
            ApplicationUser currentUser   = (db.Users.Include(r => r.Employee).Include(r => r.Employee.Campaigns).FirstOrDefault(x => x.Id == currentUserId));
            var             todayCam      = currentUser.GetTodaysCampaign();

            if (todayCam == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            WorkSession ws = new WorkSession();

            return(View(ws));
        }
コード例 #17
0
        private async Task SendOptionsEchoAsync(WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken)
        {
            if (session.IsRoslyn)
            {
                session.Roslyn.CurrentCodeActions.Clear();
            }
            var writer = sender.StartJsonMessage("optionsEcho");

            writer.WritePropertyStartObject("options");
            foreach (var pair in session.RawOptionsFromClient)
            {
                writer.WriteProperty(pair.Key, pair.Value);
            }
            writer.WriteEndObject();
            await sender.SendJsonMessageAsync(cancellationToken).ConfigureAwait(false);
        }
コード例 #18
0
        private async Task ExecuteForRoslynAsync(
            int cursorPosition,
            WorkSession session,
            ICommandResultSender sender,
            CancellationToken cancellationToken
            )
        {
            var info = await session.Roslyn.QuickInfoService
                       .GetQuickInfoAsync(session.Roslyn.Document, cursorPosition, cancellationToken)
                       .ConfigureAwait(false);

            if (IsNullOrEmpty(info))
            {
                return;
            }
            await SendInfoTipAsync(info, sender, cancellationToken).ConfigureAwait(false);
        }
コード例 #19
0
        public async Task SendItemInfoAsync(int selectedIndex, WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken)
        {
            var item        = session.CurrentCompletion.List.Items[selectedIndex];
            var description = await session.LanguageSession.GetCompletionDescriptionAsync(item, cancellationToken).ConfigureAwait(false);

            if (description == null)
            {
                return;
            }

            var writer = sender.StartJsonMessage("completionInfo");

            writer.WriteProperty("index", selectedIndex);
            writer.WritePropertyStartArray("parts");
            writer.WriteTaggedTexts(description.TaggedParts);
            writer.WriteEndArray();
            await sender.SendJsonMessageAsync(cancellationToken).ConfigureAwait(false);
        }
コード例 #20
0
ファイル: WorkSessionTest.cs プロジェクト: yonglehou/White
 public void ShouldFindControlBasedLocation()
 {
     File.Delete("foo.xml");
     using (WorkSession workSession = WorkSession())
     {
         Application application = new WinformsTestConfiguration().LaunchApplication();
         workSession.Attach(application);
         Window window = application.GetWindow("MainWindow", InitializeOption.NoCache.AndIdentifiedBy("foo"));
         window.Get <Button>("ButtonWithTooltip");
     }
     using (WorkSession workSession = WorkSession())
     {
         Application application = new WinformsTestConfiguration().LaunchApplication();
         workSession.Attach(application);
         Window window = application.GetWindow("MainWindow", InitializeOption.NoCache.AndIdentifiedBy("foo"));
         window.Get <Button>("ButtonWithTooltip");
     }
 }
コード例 #21
0
        public Task ApplyTypedCharAsync(char @char, WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken)
        {
            var current = session.CurrentCompletion;

            if (current.List != null)
            {
                return(Task.CompletedTask);
            }

            if (current.ChangeEchoPending)
            {
                current.PendingChar = @char;
                return(Task.CompletedTask);
            }
            var trigger = CompletionTrigger.CreateInsertionTrigger(@char);

            return(CheckCompletionAsync(trigger, session, sender, cancellationToken));
        }
コード例 #22
0
        private void LaunchApplication(string auctionId)
        {
            var directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var location      = Path.Combine(directoryName, @"AuctionSniper.exe");

            _app = Application.Launch(new ProcessStartInfo(
                                          location, auctionId));

            var workConfiguration =
                new WorkConfiguration
            {
                ArchiveLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                Name            = "AuctionSniper"
            };

            _workSession = new WorkSession(workConfiguration, new NullWorkEnvironment());

            _screenRepository = _workSession.Attach(_app);
        }
コード例 #23
0
        public Task ExecuteAsync(AsyncData data, WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken)
        {
            var first     = data.GetFirst();
            var firstByte = first.Array[first.Offset];

            if (firstByte == (byte)'X')
            {
                return(_completion.CancelCompletionAsync(session, sender, cancellationToken));
            }

            if (firstByte == (byte)'F')
            {
                return(_completion.ForceCompletionAsync(session, sender, cancellationToken));
            }

            var itemIndex = FastConvert.Utf8ByteArrayToInt32(first);

            return(_completion.SelectCompletionAsync(itemIndex, session, sender, cancellationToken));
        }
コード例 #24
0
        public void createApplication()
        {
            var         relPath         = @"..\..\..\ConfigurableGUI\bin\Debug";
            var         currentPath     = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var         fullPath        = Path.Combine(currentPath, relPath);
            var         appName         = @"ConfigurableGUI.exe";
            var         markpadLocation = Path.Combine(fullPath, appName);
            Application Application     = Application.Launch(markpadLocation);

            var workConfiguration = new WorkConfiguration
            {
                ArchiveLocation = fullPath,
                Name            = "ConfigurableGUI"
            };

            CoreAppXmlConfiguration.Instance.WorkSessionLocation = new DirectoryInfo(fullPath);
            theWorkSession = new WorkSession(workConfiguration, new NullWorkEnvironment());
            theScreenRepo  = theWorkSession.Attach(Application);
        }
コード例 #25
0
        public Task ExecuteAsync(AsyncData data, WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken)
        {
            var writer = sender.StartJsonMessage("self:debug");

            writer.WritePropertyStartArray("log");
            // ReSharper disable once PossibleNullReferenceException
            foreach (var entry in session.SelfDebug.GetLogEntries())
            {
                writer.WriteStartObject();
                writer.WriteProperty("time", entry.DateTime.ToString("yyyy-MM-ddTHH:mm:ss.fffK"));
                writer.WriteProperty("event", entry.EventType);
                writer.WriteProperty("message", entry.Message);
                writer.WriteProperty("cursor", entry.CursorPosition);
                writer.WriteProperty("text", entry.Text);
                writer.WriteEndObject();
            }
            writer.WriteEndArray();
            return(sender.SendJsonMessageAsync(cancellationToken));
        }
コード例 #26
0
ファイル: WorkSessionTest.cs プロジェクト: vinaybanavsi/White
 public void ShouldFindCONTROLBasedLocation()
 {
     File.Delete("foo.xml");
     using (WorkSession workSession = WorkSession())
     {
         Application application = Application.Launch(TestConfiguration.WinFormsTestAppLocation);
         workSession.Attach(application);
         Window window = application.GetWindow("Form1", InitializeOption.NoCache.AndIdentifiedBy("foo"));
         window.Get <Button>("buton");
         window.Get <Button>("addNode");
     }
     using (WorkSession workSession = WorkSession())
     {
         Application application = Application.Launch(TestConfiguration.WinFormsTestAppLocation);
         workSession.Attach(application);
         Window window = application.GetWindow("Form1", InitializeOption.NoCache.AndIdentifiedBy("foo"));
         window.Get <Button>("buton");
         window.Get <Button>("addNode");
     }
 }
コード例 #27
0
        public async Task <IActionResult> Edit(int id, [Bind("WorkSessionId,ContractId,DateWorked,ConsultantId,HoursWorked,WorkDescription,HourlyRate,ProvincialTax,TotalChargeBeforeTax")] WorkSession workSession)
        {
            if (id != workSession.WorkSessionId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    WorkSession thisWorkSession = workSession;
                    //var thisWorkSessionHourlyRate = await _context.Consultant
                    //                               .Where(c => c.ConsultantId == thisWorkSession.ConsultantId)
                    //                               .Select(c => c.HourlyRate)
                    //                               .SingleOrDefaultAsync();

                    //thisWorkSession.HourlyRate = thisWorkSessionHourlyRate;

                    _context.Update(thisWorkSession);
                    TempData["message"] = "WorkSession edited successfully";

                    await _context.SaveChangesAsync();
                }
                catch (Exception ex)
                {
                    if (!WorkSessionExists(workSession.WorkSessionId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        TempData["message"] = "Exception editing WorkSession " + ex.GetBaseException().Message;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ConsultantId"] = new SelectList(_context.Consultant, "ConsultantId", "FirstName", workSession.ConsultantId);
            ViewData["ContractId"]   = new SelectList(_context.Contract, "ContractId", "Name", workSession.ContractId);
            return(View(workSession));
        }
コード例 #28
0
        public async Task <IActionResult> Create([Bind("WorkSessionId,ContractId,DateWorked,ConsultantId,HoursWorked,WorkDescription,HourlyRate,ProvincialTax,TotalChargeBeforeTax")] WorkSession workSession)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(workSession);
                    await _context.SaveChangesAsync();

                    TempData["Message"] = "added";
                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch (Exception ex)
            {
                TempData["Message"] = "Create exception: " + ex.GetBaseException().Message;
            }
            //ViewData["ConsultantId"] = new SelectList(_context.Consultant, "ConsultantId", "FirstName", workSession.ConsultantId);
            //ViewData["ContractId"] = new SelectList(_context.Contract, "ContractId", "Name", workSession.ContractId);
            return(View(workSession));
        }
コード例 #29
0
        public async Task <IActionResult> Edit(int id, [Bind("WorkSessionId,ContractId,DateWorked,ConsultantId,HoursWorked,WorkDescription,HourlyRate,ProvincialTax,TotalChargeBeforeTax")] WorkSession workSession)
        {
            if (id != workSession.WorkSessionId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    try
                    {
                        _context.Update(workSession);
                        await _context.SaveChangesAsync();

                        TempData["Message"] = "Updated";
                    }
                    catch (DbUpdateConcurrencyException)
                    {
                        if (!WorkSessionExists(workSession.WorkSessionId))
                        {
                            return(NotFound());
                        }
                        else
                        {
                            throw;
                        }
                    }
                    return(RedirectToAction(nameof(Index)));
                }
                catch (Exception ex)
                {
                    TempData["Message"] = ex.GetBaseException().Message;
                }
            }
            //ViewData["ConsultantId"] = new SelectList(_context.Consultant, "ConsultantId", "FirstName", workSession.ConsultantId);
            //ViewData["ContractId"] = new SelectList(_context.Contract, "ContractId", "Name", workSession.ContractId);
            return(View(workSession));
        }
コード例 #30
0
        public async Task ExecuteAsync(AsyncData data, WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken)
        {
            // this doesn't happen too often, so microptimizations are not required
            var optionsString = await AsyncDataConvert.ToUtf8StringAsync(data, 0, _charArrayPool).ConfigureAwait(false);

            var options = optionsString
                          .Split(Comma)
                          .Select(p => p.Split(EqualsSign))
                          .ToDictionary(p => p[0], p => p[1]);

            if (options.TryGetValue(LanguageOptionName, out var language))
            {
                // this has to be done first, as it might reset other options
                SetLanguage(session, language);
                session.RawOptionsFromClient[LanguageOptionName] = language;
            }

            foreach (var option in options)
            {
                var(name, value) = (option.Key, option.Value);
                if (name == LanguageOptionName)
                {
                    continue;
                }

                if (name.StartsWith("x-"))
                {
                    if (!(_extension?.TrySetOption(session, name, value) ?? false))
                    {
                        throw new FormatException($"Extension option '{name}' was not recognized.");
                    }
                    session.RawOptionsFromClient[name] = value;
                    continue;
                }

                throw new FormatException($"Option '{name}' was not recognized (to use {nameof(ISetOptionsFromClientExtension)}, make sure your option name starts with 'x-').");
            }

            await SendOptionsEchoAsync(session, sender, cancellationToken).ConfigureAwait(false);
        }
コード例 #31
0
        // GET: HKWorkSessions/Create
        public IActionResult Create()
        {
            int contractID = (int)HttpContext.Session.GetInt32("ContractID");

            if (_context.Contract.Where(w => w.ContractId == contractID && w.Closed).Any())
            {
                TempData["Message"] = "Work session cannot be created because contract was closed";
                //return RedirectToAction("Index", "HKWorkSesstion");
                return(RedirectToAction(nameof(Index)));
            }
            //ViewData["ConsultantId"] = new SelectList(_context.Consultant, "ConsultantId", "FirstName");
            //ViewData["ContractId"] = new SelectList(_context.Contract, "ContractId", "Name");

            WorkSession ws = new WorkSession();

            ws.ContractId           = contractID;
            ws.HourlyRate           = 0;
            ws.ProvincialTax        = 0;
            ws.TotalChargeBeforeTax = 0;

            return(View(ws));
        }
コード例 #32
0
        public async Task ExecuteAsync(AsyncData data, WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken)
        {
            // Temporary suppression, need to figure out the best approach here.
            // ReSharper disable once HeapView.BoxingAllocation
            var diagnostics = (IReadOnlyList <Diagnostic>) await session.LanguageSession.GetDiagnosticsAsync(cancellationToken).ConfigureAwait(false);

            object extensionResult = null;

            try {
                if (_extension != null)
                {
                    var mutableDiagnostics = diagnostics.ToList();
                    extensionResult = await _extension.ProcessAsync(session, mutableDiagnostics, cancellationToken).ConfigureAwait(false);

                    diagnostics = mutableDiagnostics;
                }
                await SendSlowUpdateAsync(diagnostics, session, extensionResult, sender, cancellationToken).ConfigureAwait(false);
            }
            finally {
                (extensionResult as IDisposable)?.Dispose();
            }
        }
コード例 #33
0
        private void LaunchApplication(string auctionId)
        {
            var directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var location = Path.Combine(directoryName, @"AuctionSniper.exe");
            _app = Application.Launch(new ProcessStartInfo(
                location, auctionId));

            var workConfiguration =
                new WorkConfiguration
                {
                    ArchiveLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                    Name = "AuctionSniper"
                };

            _workSession = new WorkSession(workConfiguration, new NullWorkEnvironment());

            _screenRepository = _workSession.Attach(_app);
        }