Example #1
0
                /// <summary>
                /// Performs the <see cref="Closing"/> operator on the given
                /// <see cref="Matrix"/>.
                /// </summary>
                /// <param name="src">
                /// The <see cref="Matrix"/> which should be used by the
                /// operator.
                /// </param>
                /// <returns> The closed <see cref="Matrix"/>. </returns>
                public Matrix Execute (Matrix src)
                {
                        Closing closing = new Closing (this.se);

                        Matrix closed = closing.Execute (src);
                        return (src.isLogical() ? 
                                (closed & (!src)) : (closed - src));
                }
 /// <summary>
 /// Fires the Closing event.
 /// </summary>
 /// <param name="cea">An CancelEventArgs containing the event data.</param>
 public void OnClosing(CancelEventArgs cea)
 {
     if (_parent != null)
     {
         _parent.OnClosing(cea);
     }
     else
     {
         Closing?.Invoke(this, cea);
     }
 }
Example #3
0
        public StateBankAccount()
        {
            _confirmingIdentity = new ConfirmingIdentity(this);
            _accountActive = new AccountActive(this);
            _frozen = new Frozen(this);
            _closing = new Closing(this);
            _closed = new Closed(this);

            Balance = 0.0;
            _state = _confirmingIdentity;
        }
Example #4
0
        protected override void OnDocumentClosing(IDocument document)
        {
            var sd = document as ISledDocument;

            if (sd == null)
            {
                return;
            }

            Closing.Raise(this, new SledDocumentServiceEventArgs(sd));
        }
Example #5
0
        private void closingзакрытиеToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (mmCore.coreSize == 0)
            {
                MessageBox.Show("Set core first", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Filters filter = new Closing(mmCore);

            backgroundWorker1.RunWorkerAsync(filter);
        }
Example #6
0
        private void OnClosing()
        {
            var e = new CancellableEventArgs();

            Closing?.Invoke(this, e);
            if (!e.Cancelled)
            {
                _nativeWindow.Destroy();
                CoreWindow cw;
                _coreWindows.TryRemove(_nativeWindow, out cw);
            }
        }
Example #7
0
 public void Close()
 {
     if (Closing != null)
     {
         Closing.Invoke(this, new EventArgs() as MouseEventArgs);
     }
     if (_timerOpen != null)
     {
         _timerOpen.Stop();
     }
     MenuPopup.IsOpen = false;
     OpenMenuList.Remove(this);
 }
Example #8
0
 private void закрытиеToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (kernel != null)
     {
         Closing filter = new Closing(kernel);
         backgroundWorker1.RunWorkerAsync(filter);
     }
     else
     {
         Closing filter = new Closing();
         backgroundWorker1.RunWorkerAsync(filter);
     }
 }
        /// <summary>
        /// Raises the Closing event with a deferral to wait the event handlers to complete the execution.
        /// </summary>
        /// <returns></returns>
        protected virtual Task OnClosingAsync()
        {
            if (!_closingInvoked)
            {
                _closingInvoked = true;

                var e = new DeferralEventArgs();
                Closing.RaiseEvent(this, e);
                return(e.WaitForDeferralsAsync());
            }

            return(Task.FromResult <object>(null));
        }
Example #10
0
        public string PrintError(Closing obj)
        {
            string erroroutput = "";
            KeyValuePair <string, string> first = obj.Errors.ElementAt(0);

            erroroutput += first.Key + "," + first.Value;
            foreach (KeyValuePair <string, string> pair in obj.Errors.Skip(1))
            {
                erroroutput += Environment.NewLine;
                erroroutput += pair.Key + "," + pair.Value;
            }
            return(erroroutput);
        }
        /// <summary>
        /// Dismiss the notification
        /// </summary>
        /// <param name="dismissKind">Kind of action that triggered dismiss event</param>
        private void Dismiss(InAppNotificationDismissKind dismissKind)
        {
            lock (_openAnimationTimer)
                lock (_closingAnimationTimer)
                    lock (_dismissTimer)
                    {
                        if (Visibility == Visibility.Visible)
                        {
                            _dismissTimer.Stop();

                            // Continue to display notification if on remaining stacked notification
                            if (_stackedNotificationOptions.Any())
                            {
                                _stackedNotificationOptions.RemoveAt(0);

                                if (_stackedNotificationOptions.Any())
                                {
                                    var notificationOptions = _stackedNotificationOptions[0];

                                    UpdateContent(notificationOptions);

                                    if (notificationOptions.Duration > 0)
                                    {
                                        _dismissTimer.Interval = TimeSpan.FromMilliseconds(notificationOptions.Duration);
                                        _dismissTimer.Start();
                                    }

                                    return;
                                }
                            }

                            _openAnimationTimer.Stop();
                            _closingAnimationTimer.Stop();

                            var closingEventArgs = new InAppNotificationClosingEventArgs(dismissKind);
                            Closing?.Invoke(this, closingEventArgs);

                            if (closingEventArgs.Cancel)
                            {
                                return;
                            }

                            VisualStateManager.GoToState(this, StateContentCollapsed, true);

                            _lastDismissKind = dismissKind;

                            _closingAnimationTimer.Interval = AnimationDuration;
                            _closingAnimationTimer.Start();
                        }
                    }
        }
Example #12
0
        private void OnIsOpenChanged()
        {
            IsOpenChanged?.Invoke(this, EventArgs.Empty);

            if (!IsOpen)
            {
                if (PopupAnimation == PopupAnimation.Fade && SuppressFadeAnimation)
                {
                    StopAnimation();
                }

                Closing?.Invoke(this, EventArgs.Empty);
            }
        }
Example #13
0
        public Closing CloseObject(Closing closing, IAccountService _accountService,
                                   IGeneralLedgerJournalService _generalLedgerJournalService, IValidCombService _validCombService)
        {
            if (_validator.ValidCloseObject(closing, this))
            {
                // Count ValidComb for each leaf account
                IList <Account> leafAccounts = _accountService.GetLeafObjects();
                foreach (var leaf in leafAccounts)
                {
                    DateTime EndDate = closing.EndDatePeriod.AddDays(1);
                    IList <GeneralLedgerJournal> ledgers = _generalLedgerJournalService.GetQueryable()
                                                           .Where(x => x.AccountId == leaf.Id &&
                                                                  x.TransactionDate >= closing.BeginningPeriod &&
                                                                  x.TransactionDate < EndDate)
                                                           .ToList();
                    decimal totalAmountInLedgers = 0;
                    foreach (var ledger in ledgers)
                    {
                        Account account = _accountService.GetObjectById(ledger.AccountId);
                        if ((ledger.Status == Constant.GeneralLedgerStatus.Debit &&
                             (account.Group == Constant.AccountGroup.Asset ||
                              account.Group == Constant.AccountGroup.Expense)) ||
                            (ledger.Status == Constant.GeneralLedgerStatus.Credit &&
                             (account.Group == Constant.AccountGroup.Liability ||
                              account.Group == Constant.AccountGroup.Equity ||
                              account.Group == Constant.AccountGroup.Revenue)))
                        {
                            totalAmountInLedgers += ledger.Amount;
                        }
                        else
                        {
                            totalAmountInLedgers -= ledger.Amount;
                        }
                    }

                    ValidComb validComb = _validCombService.FindOrCreateObjectByAccountAndClosing(leaf.Id, closing.Id);
                    validComb.Amount = totalAmountInLedgers;
                    _validCombService.UpdateObject(validComb, _accountService, this);
                }

                var groupNodeAccounts = _accountService.GetQueryable().Where(x => !x.IsLeaf).OrderByDescending(x => x.Level);
                foreach (var groupNode in groupNodeAccounts)
                {
                    FillValidComb(groupNode, closing, _accountService, _validCombService);
                }

                _repository.CloseObject(closing);
            }
            return(closing);
        }
Example #14
0
        private void fillHoleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GrayscaleBT709 greyscale = new GrayscaleBT709();
            Bitmap         grey      = greyscale.Apply(skin);
            Threshold      filter    = new Threshold(100);

            filter.ApplyInPlace(grey);
            Closing close = new Closing();
            Bitmap  j     = close.Apply(grey);
            Opening open  = new Opening();

            k = open.Apply(j);
            pictureBox3.Image = k;
        }
Example #15
0
 public async Task <ClosingResult> SaveAsync(string sessionKey, Closing closing)
 {
     return(await authorizationProcessor.DoAuthorizeAsync(sessionKey, async token =>
     {
         var result = await closingProcessor.SaveAsync(closing, token);
         return new ClosingResult
         {
             ProcessResult = new ProcessResult {
                 Result = true
             },
             Closing = result,
         };
     }, logger));
 }
        public virtual void Shutdown()
        {
            Closing?.Invoke();
            // ProjectSettings is accessing some information from runtime during save
            AndroidLogcatProjectSettings.Save(m_ProjectSettings, ProjectSettingsPath, this);
            SaveEditorSettings(m_Settings);

            m_Initialized     = false;
            m_Settings        = null;
            m_ProjectSettings = null;
            m_Tools           = null;
            m_Dispatcher.Shutdown();
            m_Dispatcher = null;
        }
        /// <summary>
        /// Closes all cells.
        /// </summary>
        public void Close()
        {
            Closing?.Invoke(this, EventArgs.Empty);

            // rotate plus icon
            CATransaction.AnimationDuration = 0.8;
            plusLayer.Transform             = CATransform3D.MakeRotation(0, 0, 0, 1);

            baseView.Close(CellArray());

            IsClosed = true;

            Closed?.Invoke(this, EventArgs.Empty);
        }
Example #18
0
        internal void Close()
        {
            var args = new CancelEventArgs(false);

            Closing?.Invoke(this, args);
            if (args.Cancel)
            {
                return;
            }

            Terminal.Gui.Application.RequestStop();
            Terminal.Gui.Application.Refresh();
            Closed?.Invoke(this, EventArgs.Empty);
        }
Example #19
0
 public Closing OpenObject(Closing closing, IAccountService _accountService, IValidCombService _validCombService)
 {
     if (_validator.ValidOpenObject(closing))
     {
         IList <Account> allAccounts = _accountService.GetAll();
         foreach (var account in allAccounts)
         {
             ValidComb validComb = _validCombService.FindOrCreateObjectByAccountAndClosing(account.Id, closing.Id);
             validComb.Amount = 0;
             _validCombService.UpdateObject(validComb, _accountService, this);
         }
     }
     return(_repository.OpenObject(closing));
 }
Example #20
0
        internal void Close()
        {
            var args = new EventArgs();

            try
            {
                Closing?.Invoke(this, args);
            }
            // ReSharper disable once EmptyGeneralCatchClause
            catch
            {
            }
            CloseComplete?.Invoke(this, args);
        }
            internal void ProcessClose(bool updateActiveContext)
            {
                // Todo: it might already be closed...
                // For now, continue asserting as it can be clicked through.
                Debug.Assert(_openTextBuffer != null);
                Closing?.Invoke(this, updateActiveContext);

                var buffer = _openTextBuffer;

                _openTextBuffer = null;

                _snapshotTracker.StopTracking(buffer);
                _fileChangeTracker.StartFileChangeListeningAsync();
            }
Example #22
0
        /// <summary>
        /// Gets the window.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        /// <param name="isDialogWindow">if set to <c>true</c> [is dialog window].</param>
        /// <returns>Window.</returns>
        private Window GetWindow(ViewModelBase viewModel, bool isDialogWindow)
        {
            lock (LockObject)
            {
                var window = _openedWindows.SingleOrDefault(w => w.DataContext == viewModel);

                if (window != null)
                {
                    window.WindowState = WindowState.Normal;
                    window.Activate();
                    return(window);
                }

                if (isDialogWindow)
                {
                    // Set window owner in order to prevent that it becomes hidden when minimizing the application
                    window = new DialogWindow
                    {
                        Owner = _openedWindows.Any() ? _openedWindows.Last() : Application.Current.MainWindow
                    };
                }
                else
                {
                    // Doesn't need a window owner since it's shown in the taskbar
                    window = new StandardWindow();
                }

                _openedWindows.Add(window);

                window.Closed += (sender, e) =>
                {
                    Closed?.Invoke(sender, e);

                    _openedWindows.Remove(window);
                    window = null;

                    if (!_openedWindows.Any() && Application.Current.MainWindow != null)
                    {
                        Application.Current.MainWindow.Activate();
                    }
                };

                window.Closing += (sender, e) =>
                {
                    Closing?.Invoke(sender, e);
                };
                return(window);
            }
        }
Example #23
0
        private bool InternalHide(LightContentDialogResult contentDialogResult)
        {
            LightContentDialogClosingEventArgs lightContentDialogClosingEventArgs = new LightContentDialogClosingEventArgs(contentDialogResult);

            Closing?.Invoke(this, lightContentDialogClosingEventArgs);

            if (!lightContentDialogClosingEventArgs.Cancel && (global::Avalonia.Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)?.MainWindow is FormsWindow window)
            {
                window.Hide();
                LightContentDialogClosedEventArgs lightContentDialogClosedEventArgs = new LightContentDialogClosedEventArgs(contentDialogResult);
                Closed?.Invoke(this, lightContentDialogClosedEventArgs);
                return(true);
            }
            return(false);
        }
Example #24
0
        /// <inheritdoc />
        public void Close(string reason)
        {
            Closing?.Invoke(this, new ConnectionClosingEventArgs(reason));

            Closing = null;
            if (!_isActive.FlipIf(true))
            {
                return;
            }

            _socket.Close();

            _receiveDescriptor.Close();
            _sendDescriptor.Close();
        }
Example #25
0
        protected virtual async Task OnClosing(WorkbenchWindowEventArgs e)
        {
            if (Closing != null)
            {
                foreach (var handler in Closing.GetInvocationList().Cast <WorkbenchWindowAsyncEventHandler> ())
                {
                    await handler(this, e);

                    if (e.Cancel)
                    {
                        break;
                    }
                }
            }
        }
Example #26
0
        async Task InternalCloseAsync(TimeSpan timeout)
        {
            State = CommunicationState.Closing;
            if (Closing != null)
            {
                Closing.Invoke(this, EventArgs.Empty);
            }
            await CloseAsync(timeout);

            State = CommunicationState.Closed;
            if (Closed != null)
            {
                Closed.Invoke(this, EventArgs.Empty);
            }
        }
Example #27
0
        private bool InternalHide(LightContentDialogResult contentDialogResult)
        {
            LightContentDialogClosingEventArgs lightContentDialogClosingEventArgs = new LightContentDialogClosingEventArgs(contentDialogResult);

            Closing?.Invoke(this, lightContentDialogClosingEventArgs);

            if (!lightContentDialogClosingEventArgs.Cancel && System.Windows.Application.Current.MainWindow is FormsWindow window)
            {
                window.HideContentDialog();
                LightContentDialogClosedEventArgs lightContentDialogClosedEventArgs = new LightContentDialogClosedEventArgs(contentDialogResult);
                Closed?.Invoke(this, lightContentDialogClosedEventArgs);
                return(true);
            }
            return(false);
        }
Example #28
0
        private bool OnIsCoerceValue(bool baseValue)
        {
            var ev = new CancelEventArgs(false);

            if (baseValue)
            {
                Opening?.Invoke(this, ev);
                return(!ev.Cancel);
            }
            else
            {
                Closing?.Invoke(this, ev);
                return(ev.Cancel);
            }
        }         // proc OnIsCoerceValue
Example #29
0
        async Task OnClosing(DocumentCloseEventArgs e)
        {
            if (Closing != null)
            {
                foreach (var handler in Closing.GetInvocationList().Cast <DocumentCloseAsyncEventHandler> ())
                {
                    await handler(this, e);

                    if (e.Cancel)
                    {
                        break;
                    }
                }
            }
        }
        public ActionResult ReportBalanceSheet(Nullable <int> closingId)
        {
            var     company = _companyService.GetQueryable().FirstOrDefault();
            Closing closing = _closingService.GetObjectById(closingId.GetValueOrDefault());

            if (closing == null)
            {
                return(Content(Constant.ErrorPage.ClosingNotFound));
            }

            var balanceValidComb = _validCombService.GetQueryable().Include("Account").Include("Closing")
                                   .Where(x => x.ClosingId == closing.Id & x.Account.Level == 2);

            List <ModelBalanceSheet> query = new List <ModelBalanceSheet>();

            query = (from obj in balanceValidComb
                     select new ModelBalanceSheet()
            {
                CompanyName = company.Name,
                StartDate = closing.BeginningPeriod,
                EndDate = closing.EndDatePeriod,
                DCNote = (obj.Account.Group == Constant.AccountGroup.Asset ||
                          obj.Account.Group == Constant.AccountGroup.Expense) ? "D" : "C",
                AccountName = obj.Account.Code.Substring(0, 1),
                AccountGroup = (obj.Account.Group == Constant.AccountGroup.Asset) ? "Asset" :
                               (obj.Account.Group == Constant.AccountGroup.Expense) ? "Expense" :
                               (obj.Account.Group == Constant.AccountGroup.Liability) ? "Liability" :
                               (obj.Account.Group == Constant.AccountGroup.Equity) ? "Equity" :
                               (obj.Account.Group == Constant.AccountGroup.Revenue) ? "Revenue" : "",
                AccountTitle = obj.Account.Name,
                CurrentAmount = obj.Amount,
                PrevAmount = obj.Amount,
                ASSET = "nonASSET",         // untuk Fix Asset ? "ASSET" : "nonASSET",
                AccountCode = obj.Account.Code
            }).OrderBy(x => x.AccountCode).ToList();

            var rd = new ReportDocument();

            //Loading Report
            rd.Load(Server.MapPath("~/") + "Reports/Finance/BalanceSheet.rpt");

            // Setting report data source
            rd.SetDataSource(query);

            var stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            return(File(stream, "application/pdf"));
        }
        public static Bitmap ProcessImage(string imagePath)
        {
            var img = AForge.Imaging.Image.FromFile(imagePath);

            ContrastStretch filterContrastStretch = new ContrastStretch();

            filterContrastStretch.ApplyInPlace(img);

            try
            {
                img = Grayscale.CommonAlgorithms.BT709.Apply(img);
            }
            catch
            {
                System.Windows.Forms.MessageBox.Show("The image should not be grayscale");
            }

            Opening filterOpening = new Opening();

            filterOpening.ApplyInPlace(img);

            SobelEdgeDetector sobel = new SobelEdgeDetector();

            sobel.ApplyInPlace(img);

            Closing filterClosing = new Closing();

            filterClosing.ApplyInPlace(img);

            Threshold threshold = new Threshold(100);

            threshold.ApplyInPlace(img);

            FillHoles fillHoles = new FillHoles();

            fillHoles.MaxHoleWidth         = img.Width;
            fillHoles.MaxHoleHeight        = img.Height;
            fillHoles.CoupledSizeFiltering = false;
            fillHoles.ApplyInPlace(img);

            filterOpening.ApplyInPlace(img);

            Erosion filterErosion = new Erosion();

            filterErosion.ApplyInPlace(img);

            return(img);
        }
Example #32
0
        public void OnClose(int Reason)
        {
            int IndentSize;

            IndentSize = Debug.IndentSize;
            Debug.WriteLine(IndentSize);

            CloseReason = (swPropertyManagerPageCloseReasons_e)Reason;

            var arg = new ClosingArg();

            Closing?.Invoke(CloseReason, arg);

            if (arg.Cancel)
            {
                if (!string.IsNullOrEmpty(arg.ErrorTitle) || !string.IsNullOrEmpty(arg.ErrorMessage))
                {
                    var title = !string.IsNullOrEmpty(arg.ErrorTitle) ? arg.ErrorTitle : "Error";

                    ShowBubbleTooltipAt2(title, arg.ErrorMessage);
                }

                throw new COMException(arg.ErrorMessage, S_FALSE);
            }

            //执行Command接口
            if (CloseReason == swPropertyManagerPageCloseReasons_e.swPropertyManagerPageClose_Okay)
            {
                bool canExecute = CloseCommand == null ? true : CloseCommand.CanExecute(null);

                if (!canExecute)
                {
                    if (CloseCommand is CloseCommand clsCmd)
                    {
                        ShowBubbleTooltipAt2(clsCmd.ErrorTitle, clsCmd.BubbleTooltip);
                    }
                    else
                    {
                        ShowBubbleTooltipAt2("无法执行", "未知错误");
                    }
                    const int S_FALSE = 1;
                    throw new COMException(arg.ErrorMessage, S_FALSE);
                }
            }
            //DeAttach Doc Selection Event
            //_selectionBoxs.Clear();
            //DeAttachDocEvent();
        }