public Bitmap BlurImage(Bitmap image)
        {
            if (image == null)
                return null;

            image = RGB565toARGB888(image);
            if (!configured)
            {
                input = Allocation.CreateFromBitmap(rs, image);
                output = Allocation.CreateTyped(rs, input.Type);
                script = ScriptIntrinsicBlur.Create(rs, Element.U8_4(rs));
                script.SetRadius(BLUR_RADIUS);
                configured = true;
            }
            else
            {
                input.CopyFrom(image);
            }

            script.SetInput(input);
            script.ForEach(output);
            output.CopyTo(image);

            return image;
        }
示例#2
0
 void ICreditsRepository.CreateAllocation(Allocation allocation)
 {
     using (var dc = CreateContext())
     {
         dc.CreditAllocationEntities.InsertOnSubmit(allocation.Map());
         dc.SubmitChanges();
     }
 }
示例#3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Allocation allocation = _db.Allocations.Find(id);

            _db.Allocations.Remove(allocation);
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#4
0
        public bool AllocationStatus(PageType pageType)
        {
            var interval = Database.AllocationInterval;

            var page = new AllocationPage(Database, Allocation.AllocationPageAddress(PageAddress, pageType));

            return(page.AllocationMap[(interval / 8) + 1]);
        }
示例#5
0
        private int GetValueFromY(double py)
        {
            Rectangle rect = GradientRectangle;
            Rectangle all  = Allocation.ToCairoRectangle();

            py -= all.Y + ypad * all.Height;
            return((int)(255 * (rect.Height - py) / rect.Height));
        }
        public void Allocate(Allocation allocation)
        {
            Vaidate(allocation);

            allocation.Enable();

            allocationRepository.Save(allocation);
        }
示例#7
0
        public Allocation Save(Allocation allocation)
        {
            allocation.Validate();
            string sql = "INSERT INTO TBAllocation(StartHour, EndHour, RoomId, EmployeeId) VALUES('2018-05-23T14:25:00', '2018-05-23T15:00:00', 1, 1)";

            allocation.Id = Db.Insert(sql, Take(allocation, false));
            return(allocation);
        }
示例#8
0
        Allocation Push(Expression e)
        {
            Allocation allocation = function.Top();

            Move(allocation, e);
            allocation.Allocate();
            return(allocation);
        }
示例#9
0
        // Expression evaluation.

        void Move(Allocation allocation, Expression e)
        {
            Allocation oldtarget = target;

            target = allocation;
            e.Accept(this);
            target = oldtarget;
        }
示例#10
0
        public void AllocationIntegration_Add_Nome_ShouldBeFail()
        {
            Allocation allocation = ObjectMother.GetInvalidEndHourAllocation(ObjectMother.GetEmployee(), ObjectMother.GetRoom());

            Action comparison = () => _service.Save(allocation);

            comparison.Should().Throw <AllocationEndHourEarlyThanStartException>();
        }
示例#11
0
        public void AllocationIntegration_Update_Invalid_Id_ShouldBeFail()
        {
            Allocation model = ObjectMother.GetAllocation(ObjectMother.GetEmployee(), ObjectMother.GetRoom());

            Action comparison = () => _service.Update(model);

            comparison.Should().Throw <IdentifierUndefinedException>();
        }
示例#12
0
        public async Task <IActionResult> Create([Bind("EmployeeID,EmployeeName,Department,Phone,BoardingPoint,Address,Age,Gender,Email")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                if (employee.BoardingPoint != null)
                {
                    var RoutesAvaiability = _context.Routes.Where(m => m.StartingPoint == employee.BoardingPoint || m.StopOne == employee.BoardingPoint || m.StopTwo == employee.BoardingPoint || m.StopThree == employee.BoardingPoint);
                    //Check Routes Availablity

                    if (RoutesAvaiability != null && RoutesAvaiability.Count() > 0)

                    {
                        var VehicleAvaiability = _context.Vehicles.Where(m => m.SeatsAvailable > 0 & m.Location == employee.BoardingPoint).FirstOrDefault();
                        // Check vehicle availability
                        //  if (VehicleAvaiability != null & VehicleAvaiability.Count() > 0)
                        if (VehicleAvaiability != null)
                        {
                            _context.Add(employee);
                            // Reduce the Seats
                            int    final_seat            = VehicleAvaiability.SeatsAvailable;
                            string driver_name           = VehicleAvaiability.DriverName;
                            string driver_contact_number = VehicleAvaiability.DriverContactNumber;
                            string Vehicle_no            = VehicleAvaiability.VehicleNumber;
                            string location = VehicleAvaiability.Location;
                            final_seat = final_seat - 1;
                            await _context.Vehicles.Where(m => m.Location == location& m.DriverName == driver_name).ForEachAsync(s => s.SeatsAvailable = final_seat);

                            await _context.SaveChangesAsync();



                            // Add Values to Allocation
                            var a_employee_name     = employee.EmployeeName;
                            var a_boarding_location = employee.BoardingPoint;
                            var a_driver_name       = driver_name;
                            var a_contact_number    = driver_contact_number;
                            var a_vehicle_no        = Vehicle_no;
                            var a_allocations       = new Allocation {
                                BoardingPoint = a_boarding_location, DriverContactNumber = a_contact_number, DriverName = a_driver_name, EmployeeName = a_employee_name, VehicleNumber = a_vehicle_no
                            };
                            _context.Allocations.Add(a_allocations);
                            await _context.SaveChangesAsync();

                            return(RedirectToAction(nameof(Index)));
                        }
                    }
                    else
                    {
                        return(View());
                    }
                }
                else
                {
                    // if (employee.BoardingPoint != null )
                }
            }//Model State
            return(View(employee));
        }
        private void EnsureApplicantCredits(Allocation allocation)
        {
            // Get current allocations.

            var allocations = _allocationsQuery.GetActiveAllocations <ApplicantCredit>(allocation.OwnerId);

            if (allocation.InitialQuantity != null)
            {
                // Don't allocate if there are existing non-zero limited credits.
                // This is based on the assumption that the user was given a finite number of both JobAd and Applicant credits.

                if ((from a in allocations where a.RemainingQuantity != null && a.RemainingQuantity.Value != 0 select a).Any())
                {
                    return;
                }
            }

            // Need to ensure there are unlimited credits.

            var unlimitedAllocations = (from a in allocations where a.RemainingQuantity == null select a).ToList();

            if (unlimitedAllocations.Count > 0)
            {
                // If there are any that do not expire then that is enough.

                if (unlimitedAllocations.Any(a => a.ExpiryDate == null))
                {
                    return;
                }

                // There are unlimited credits but need to check their expiry.

                if (allocation.ExpiryDate != null)
                {
                    if (unlimitedAllocations.Any(a => a.ExpiryDate != null && allocation.ExpiryDate != null && a.ExpiryDate.Value >= allocation.ExpiryDate.Value.AddMonths(2)))
                    {
                        return;
                    }
                }
            }

            // Need to create an allocation.

            var expiryDate = allocation.ExpiryDate == null
                ? (DateTime?)null
                : allocation.ExpiryDate.Value.AddMonths(2) > DateTime.Now.AddYears(1)
                    ? allocation.ExpiryDate.Value.Date.AddMonths(2)
                    : DateTime.Now.Date.AddYears(1);

            _allocationsCommand.CreateAllocation(new Allocation
            {
                OwnerId         = allocation.OwnerId,
                CreditId        = _creditsQuery.GetCredit <ApplicantCredit>().Id,
                InitialQuantity = null,
                ExpiryDate      = expiryDate
            });
        }
示例#14
0
        public void AllocationRepository_Update_ShouldBeFail()
        {
            Allocation allocation = ObjectMother.GetAllocation(ObjectMother.GetEmployee(), ObjectMother.GetRoom());

            allocation.Id = 0;
            Action update = () => _repository.Update(allocation);

            update.Should().Throw <IdentifierUndefinedException>();
        }
示例#15
0
        TextFileInfo ReadTextFile(string filename)
        {
            Console.WriteLine("ReadTextFile " + filename);
            char[] seperatorTab = {'\t'};
            char[] seperatorColon = {':'};
            TextFileInfo fi = new TextFileInfo();
            fi.filename = filename;
            string currentPool = "";
            StreamReader re = File.OpenText(filename);
            string input = null;
            while ((input = re.ReadLine()) != null)
            {
                input.Trim();
                if (input.StartsWith("MemPool:"))
                    currentPool = input.Substring(8);
                else
                {
                    string[] line = input.Split(seperatorTab);
                    int size = int.Parse(line[2]);
                    Allocation a = new Allocation();
                    a.name = line[0];
                    a.ptr = Int32.Parse(line[1], System.Globalization.NumberStyles.AllowHexSpecifier);
                    a.pool = currentPool;
                    a.size = size;
                    fi.allocations.Add(a);

                    // Handle blocks (identically named allocations)
                    Category c;
                    if (fi.blocks.ContainsKey(line[0]))
                        c = fi.blocks[line[0]];
                    else
                        c = new Category();
                    c.name = line[0];
                    c.size += size;
                    ++c.count;

                    fi.blocks[line[0]] = c;

                    // Handle categories
                    string catString = "NO CATEGORY";
                    if (line[0].Contains(":"))
                        catString = line[0].Split(seperatorColon)[0];

                    if (fi.categories.ContainsKey(catString))
                        c = fi.categories[catString];
                    else
                        c = new Category();
                    c.name = catString;
                    c.size += size;
                    ++c.count;

                    fi.categories[catString] = c;
                }
            }
            re.Close();
            return fi;
        }
示例#16
0
        private static void Prepare(Allocation allocation)
        {
            allocation.Prepare();

            // Set the remaining quantity to the initial quantity when creating.

            allocation.RemainingQuantity = allocation.InitialQuantity;
            allocation.DeallocatedTime   = null;
        }
示例#17
0
        public void Ctor_ATinyAmountMoneyNotAllocated_QuasiComplete()
        {
            var subject = new Allocation(10m.Usd(), new[] { 9.99m.Usd(), .0001m.Usd() });

            Assert.That(subject.IsComplete, Is.False);
            Assert.That(subject.IsQuasiComplete, Is.True);
            Assert.That(subject.TotalAllocated, Is.EqualTo(9.9901m.Usd()));
            Assert.That(subject.Remainder, Is.EqualTo(.0099m.Usd()));
        }
示例#18
0
        public void Ctor_Debt_CanBeFullyAllocated()
        {
            var subject = new Allocation(-10m.Usd(), new[] { -3m.Usd(), -7m.Usd() });

            Assert.That(subject.TotalAllocated, Is.EqualTo(-10m.Usd()));
            Assert.That(subject.Remainder, Is.EqualTo(Money.Zero(CurrencyIsoCode.USD)));
            Assert.That(subject.IsComplete, Is.True);
            Assert.That(subject.IsQuasiComplete, Is.False);
        }
示例#19
0
        public void Visit(Index e)
        {
            Allocation table = R(e.Table);
            Allocation key   = RK(e.Key);

            function.InstructionABC(e.SourceSpan, Opcode.GetTable, target, table, key);
            key.Release();
            table.Release();
        }
示例#20
0
文件: Box.cs 项目: codyn-net/studio
        public override void Draw(Cairo.Context context)
        {
            Allocation allocation = d_object != null ? d_object.Allocation : new Allocation(0, 0, 1, 1);

            Cache.Render(context, allocation.Width, allocation.Height, delegate(Cairo.Context graphics, double width, double height)
            {
                graphics.Save();

                double uw   = graphics.LineWidth;
                double marg = uw / 2;

                if (d_radius > 0)
                {
                    DrawRoundedRectangle(graphics, -marg, -marg, allocation.Width + marg, allocation.Height + marg, d_radius);
                }
                else
                {
                    graphics.Rectangle(-marg, -marg, allocation.Width + marg, allocation.Height + marg);
                }

                graphics.Source = d_outer;
                graphics.FillPreserve();

                graphics.ClipPreserve();

                if (d_object != null && d_object.LinkFocus)
                {
                    graphics.LineWidth = uw * 4;
                    graphics.SetSourceRGBA(d_linkColor[0], d_linkColor[1], d_linkColor[2], d_linkColor[3]);
                    graphics.Stroke();
                }
                else if (d_object != null && d_object.MouseFocus)
                {
                    graphics.LineWidth = uw * 4;
                    graphics.SetSourceRGBA(d_hoverColor[0], d_hoverColor[1], d_hoverColor[2], d_hoverColor[3]);
                    graphics.Stroke();
                }
                else
                {
                    graphics.NewPath();
                }

                graphics.LineWidth = uw * 2;
                marg = uw;

                double[] color = LineColor();
                graphics.SetSourceRGB(color[0], color[1], color[2]);

                double dd  = allocation.Width * 0.1;
                double off = uw * 2 + (dd - (dd % marg));

                DrawInner(graphics, uw, off, off, allocation.Width - off * 2, allocation.Height - off * 2);

                graphics.Restore();
                base.Draw(graphics);
            });
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Allocation allocation = await db.Allocations.FindAsync(id);

            db.Allocations.Remove(allocation);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
示例#22
0
 void ICreditsRepository.UpdateAllocation(Allocation allocation)
 {
     using (var dc = CreateContext())
     {
         var entity = GetAllocationEntity(dc, allocation.Id);
         allocation.MapTo(entity);
         dc.SubmitChanges();
     }
 }
示例#23
0
        public void Ctor_Debt_CanBeAlmostFullyAllocated()
        {
            var subject = new Allocation(-10m.Usd(), new[] { -3m.Usd(), -6.999m.Usd() });

            Assert.That(subject.TotalAllocated, Is.EqualTo(-9.999m.Usd()));
            Assert.That(subject.Remainder, Is.EqualTo(-.001m.Usd()));
            Assert.That(subject.IsComplete, Is.False);
            Assert.That(subject.IsQuasiComplete, Is.True);
        }
示例#24
0
        public static CreditAllocationEntity Map(this Allocation allocation)
        {
            var entity = new CreditAllocationEntity {
                id = allocation.Id
            };

            allocation.MapTo(entity);
            return(entity);
        }
示例#25
0
        private void HandleExposeEvent(object o, Gtk.ExposeEventArgs args)
        {
            using (Context g = Gdk.CairoHelper.Create(this.GdkWindow)) {
                int       rad  = 4;
                Rectangle rect = Allocation.ToCairoRectangle();

                g.FillRoundedRectangle(rect, rad, CairoColor);
            }
        }
示例#26
0
        private Allocation Allocate(IOrganisation organisation, Credit credit, int?quantity, DateTime?expiryDate)
        {
            var allocation = new Allocation {
                OwnerId = organisation.Id, CreditId = credit.Id, ExpiryDate = expiryDate, InitialQuantity = quantity
            };

            _allocationsCommand.CreateAllocation(allocation);
            return(allocation);
        }
        private void Pop(Allocation expected)
        {
            Allocation alloc = _stack.Pop();

            if (expected != alloc)
            {
                throw new InvalidProgramException();
            }
        }
示例#28
0
    public Bitmap blur(Bitmap bitmap, float radius, int repeat)
    {
        if (!IS_BLUR_SUPPORTED)
        {
            return(null);
        }

        if (radius > MAX_RADIUS)
        {
            radius = MAX_RADIUS;
        }

        int width  = bitmap.Width;
        int height = bitmap.Height;

        // Create allocation type
        Type bitmapType = new Type.Builder(rs, Element.RGBA_8888(rs))
                          .SetX(width)
                          .SetY(height)
                          .SetMipmaps(false) // We are using MipmapControl.MIPMAP_NONE
                          .Create();

        // Create allocation
        Allocation allocation = Allocation.CreateTyped(rs, bitmapType);

        // Create blur script
        ScriptIntrinsicBlur blurScript = ScriptIntrinsicBlur.Create(rs, Element.U8_4(rs));

        blurScript.SetRadius(radius);

        // Copy data to allocation
        allocation.CopyFrom(bitmap);

        // set blur script input
        blurScript.SetInput(allocation);

        // invoke the script to blur
        blurScript.ForEach(allocation);

        // Repeat the blur for extra effect
        for (int i = 0; i < repeat; i++)
        {
            blurScript.ForEach(allocation);
        }

        // copy data back to the bitmap
        allocation.CopyTo(bitmap);

        // release memory
        allocation.Destroy();
        blurScript.Destroy();
        allocation = null;
        blurScript = null;

        return(bitmap);
    }
示例#29
0
        public void Update(Allocation allocation)
        {
            CurrentAllocation = allocation;

            if (AllowSymbolsErrors && !File.Exists(SymbolLookup.SymbolsPath))
            {
                symbolsNotFoundLabel.Visible = true;
            }

            if (allocation.Architecture == Common.Architecture._32Bit)
            {
                AddressLabel.Text = String.Format("Address: 0x{0:X8}", allocation.Address);
            }
            else
            {
                AddressLabel.Text = String.Format("Address: 0x{0:X16}", allocation.Address);
            }

            SizeLabel.Text = String.Format("Size: {0} bytes", allocation.Size);
            //HeapLabel.Text = String.Format("Heap ID: {0}", allocation.HeapId);

            StackTable.Rows.Clear();
            foreach (CallStack.Frame frame in allocation.Stack.Frames.Reverse())
            {
                String addressText;
                if (allocation.Architecture == Common.Architecture._32Bit)
                {
                    addressText = String.Format("0x{0:X8}", frame.Address);
                }
                else
                {
                    addressText = String.Format("0x{0:X16}", frame.Address);
                }

                // TODO: Is this parser-specific?
                String functionName = "";
                if (SymbolLookup.Instance != null)
                {
                    String rawFunctionName = SymbolLookup.Instance.Lookup(frame.Address);
                    if (String.IsNullOrEmpty(rawFunctionName) || rawFunctionName.Contains("NULL_THUNK_DATA"))
                    {
                        functionName += "Unknown";
                    }
                    else
                    {
                        functionName += rawFunctionName;
                    }
                }
                else
                {
                    functionName += "Unknown";
                }

                StackTable.Rows.Add(addressText, functionName, "", "");
            }
        }
示例#30
0
        public void ShouldNotBeAbleToCreateATargetAccountWithAccountAndAllocationPercentage()
        {
            var account = new Account(new AccountId(12345678), new ClientId("ABC123"))
            {
                Balance = 100, LastUpdatedDate = DateTime.Now
            };
            var targetAccount = new Allocation(account, 2);

            Assert.AreEqual(targetAccount.GetAccountNumber(), account.GetAccountNumber());
        }
示例#31
0
        public Allocation Allocate(CreditNote creditNote, Allocation allocation)
        {
            string requestXml = ModelSerializer.Serialize(allocation);

            string responseXml = _proxy.ApplyAllocation(creditNote, requestXml);

            Response response = ModelSerializer.DeserializeTo <Response>(responseXml);

            return(response.GetTypedProperty <Allocation>().First());
        }
 public ActionResult Edit([Bind(Include = "Id,Name,Description,IsMonthly,RecuranceDayNumber,RecuranceEndDate,AllocationType,Amount")] Allocation allocation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(allocation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(allocation));
 }
示例#33
0
        public void addResource(Resource r, int amount, DateTime from, DateTime to)
        {
            Allocation l = new Allocation(from, to, r, this, amount);

            if (ResourceAllocator.getInstance().isConsistent(l))
            {
                Resources.Add(l);
                AllocationStorage.getInstance().create(l);
            }
        }
        public void AllocationHistory_Init()
        {
            FXMarketHistory   fxmh      = MarketTestTools.CreateMktHistory();
            AllocationHistory allocH    = AllocationsTools.GetAllocationHistory(fxmh);
            Allocation        alloc     = allocH.GetAllocation(MarketTestTools.date1);
            Allocation        allocTest = AllocationsTools.GetAllocation();

            allocTest.Update(MarketTestTools.CreateMarket());
            Assert.IsTrue(alloc.Total.Equals(allocTest.Total));
        }
示例#35
0
文件: Program.cs 项目: EkardNT/CS143B
        private static void Driver(
			double averageRequestSize,
			double standardDeviation,
			Random random,
			int simulationSteps,
			int memorySize,
			AllocationStrategy strategy,
			out double averageSearchTime,
			out double averageMemoryUtilization)
        {
            // Setup driver.
            var mm = new MemoryManager(memorySize, strategy);
            var reserved = new List<Allocation>();

            // Statistics
            long totalHolesExamined = 0;
            double totalMemoryUtilization = 0;

            for (int i = 0; i < simulationSteps; i++)
            {
                int requestSize = random.NextGaussian(averageRequestSize, standardDeviation, 1, memorySize);
                int allocationAddr, holesExamined;
                Allocation alloc;
                while (mm.Request(requestSize, out allocationAddr, out holesExamined))
                {
                    reserved.Add(alloc = new Allocation(allocationAddr, requestSize));
                    int placeToSwap = random.Next(reserved.Count);
                    reserved[reserved.Count - 1] = reserved[placeToSwap];
                    reserved[placeToSwap] = alloc;
                    totalHolesExamined += holesExamined;
                    requestSize = random.NextGaussian(averageRequestSize, standardDeviation, 1, memorySize);
                }
                // Count holes examined by failed request.
                totalHolesExamined += holesExamined;
                // Record memory utilization.
                totalMemoryUtilization += reserved.Sum(allocation => allocation.Size) / (double)memorySize;
                // Release a random reserved segment. Because the reserved list
                // is randomly ordered, we simply (and efficiently) remove the
                // last element.
                if(reserved.Count > 0)
                {
                    mm.Release(reserved[reserved.Count - 1].Address);
                    reserved.RemoveAt(reserved.Count - 1);
                }
            }

            averageSearchTime = totalHolesExamined / (double) simulationSteps;
            averageMemoryUtilization = totalMemoryUtilization / simulationSteps;
        }
示例#36
0
        public void SelectAt(Allocation targetAllocation)
        {
            if (targetAllocation == null)
            {
                return;
            }

            Snapshot snapshot = SnapshotOverride ?? History.Snapshot;

            MemoryBlock block = snapshot.Find(targetAllocation.Address);
            if (block != null)
            {
                Renderer.SelectedBlock = block;

                SelectionChangedEventArgs e = new SelectionChangedEventArgs();
                e.SelectedBlock = Renderer.SelectedBlock;
                this.Invoke((MethodInvoker)(() => SelectionChanged(this, e)));
            }
            else
            {
                // TODO: What should be done here? Scroll the timeline to a point where it exists?
            }

            // TODO: Automatically bring the new selection into view
        }
示例#37
0
 /// <summary>
 /// Gets the allocation region associated with the given allocation id if it is present.
 /// </summary>
 /// <param name="allocationId">Allocation id to look up the allocation for.</param>
 /// <param name="allocation">Allocation associated with the id, if present.</param>
 /// <returns>True if the allocationId was present in the allocator, false otherwise.</returns>
 public bool TryGetAllocationRegion(ulong allocationId, out Allocation allocation)
 {
     return allocations.TryGetValue(allocationId, out allocation);
 }
示例#38
0
 private void AddAllocation(ulong id, long start, long end,
     ref Allocation allocation, ref Allocation nextAllocation)
 {
     var newAllocation = new Allocation
     {
         Next = allocation.Next,
         Previous = nextAllocation.Previous,
         Start = start,
         End = end
     };
     //Note that the pointer modifications come BEFORE the new addition.
     //This avoids a potential pointer invalidation caused by a resize in the allocations dictionary.
     allocation.Next = id;
     nextAllocation.Previous = id;
     //About to add a new allocation. We had space here this time, so there's a high chance we'll have some more space next time. Point the search to this index.
     searchStartIndex = allocations.Count;
     allocations.Add(id, newAllocation);
 }
示例#39
0
 private void selectBtn_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count > 0)
     {
         String name = (string)dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[0].Value;
         Resource r = ResourceStorage.getInstance().all().Find(x => x.Title.Equals(name));
         try
         {
             int amount = Convert.ToInt32(convert(cont_box.Text));
             DateTime fromDate = fromDateBox.Value;
             DateTime toDate = toDateBox.Value;
             if (toDate < fromDate)
             {
                 MessageBox.Show("بازه‌ی زمانی صحیح نمی‌باشد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading| MessageBoxOptions.RightAlign);
                 return;
             }
             alloc = new Allocation(fromDate, toDate, r, null, amount);
             if (ResourceAllocator.getInstance().isConsistent(alloc))
             {
                 this.DialogResult = DialogResult.OK;
                 this.Close();
             }
             else
             {
                 MessageBox.Show("منبع کافی نمی‌باشد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading| MessageBoxOptions.RightAlign);
             }
         }
         catch (Exception e2)
         {
             MessageBox.Show(new IncompleteFormException().Message);
         }
     }
 }
 public DropBoxSpaceUsage()
 {
     allocation = new Allocation();
 }
示例#41
0
 public static void Add(MessageType type, Allocation referenceAllocation, String text)
 {
     Instance.AddInternal(type, referenceAllocation, text);
 }
示例#42
0
        private void AddInternal(MessageType type, Allocation referenceAllocation, String text)
        {
            Task task = new Task(() =>
            {
                this.Invoke((MethodInvoker)(() =>
                {
                    switch (type)
                    {
                        case MessageType.Error:
                            {
                                Errors.Add(new StringSource(text, referenceAllocation));
                                var bindingList = new BindingList<StringSource>(Errors);
                                ErrorsDataGrid.DataSource = bindingList;
                                ErrorsForm.Text = "Errors (" + Errors.Count + ")";
                                break;
                            }
                        case MessageType.Warning:
                            {
                                Warnings.Add(new StringSource(text, referenceAllocation));
                                var bindingList = new BindingList<StringSource>(Warnings);
                                WarningsDataGrid.DataSource = bindingList;
                                WarningsForm.Text = "Warnings (" + Warnings.Count + ")";
                                break;
                            }
                        case MessageType.Info:
                            {
                                Infos.Add(new StringSource(text, referenceAllocation));
                                var bindingList = new BindingList<StringSource>(Infos);
                                InfosDataGrid.DataSource = bindingList;
                                InfosForm.Text = "Info (" + Infos.Count + ")";
                                break;
                            }
                    }
                }));
            });

            task.Start();
        }
示例#43
0
 public StringSource(String description, Allocation referenceAllocation)
     : this(description)
 {
     ReferenceAllocation = referenceAllocation;
 }