Example #1
0
        public void Sync(Action<string, Exception> action)
        {
            #region SyncCompletedHandler

            serverTaskSyncCompletedHandler = new DelegateHandler<ServerTaskSyncCompleted>(e =>
            {
                sendTaskToServer();

            });
            publisher.RegisterHandler(serverTaskSyncCompletedHandler);


            taskSyncedCompletedHandler = new DelegateHandler<TaskSyncCompleted>(e =>
                {
                    publisher.UnregisterHandler(serverTaskSyncCompletedHandler);
                    publisher.UnregisterHandler(taskSyncedCompletedHandler);
                    action("syncCompleted", null);
                    
                });
            publisher.RegisterHandler(taskSyncedCompletedHandler);

            #endregion

            getTasksFromServer();
        }
Example #2
0
        public static void Main()
        {
            // Instantiation
            // Delegate is a class, so you instantiate it by using new keyword
            DelegateHandler handler = new DelegateHandler(Foo);

            // Invocation
            Console.WriteLine("Foo will be invoked by delegate");
            handler("called from delegate");

            Console.WriteLine("Foo will be invoked directly");
            Foo("called directly");
        }
 public void DelegateButton()
 {
     var handler = new DelegateHandler(DelegateHandlerImplementation);
     DelegateNumber = handler(DelegateNumber);
 }
Example #4
0
 public Func <T> Creator()
 {
     return(DelegateHandler.Func <T>($"return new {NameScript}();"));
 }
 public void PauseGame(bool status)
 {
     IsGamePaused = status;
     DelegateHandler.GamePaused(status);
 }
Example #6
0
        public SpeedCharts()
        {
            InitializeComponent();
            ResourceDictionarySet.Instance.FillResourceDic(this, this.Resources);

            if (Design.IsInDesignMode)
            {
                return;
            }
            Guid mainCoinId = NTMinerRoot.Current.MinerProfile.CoinId;
            DelegateHandler <GpuSpeedChangedEvent> gpuSpeedChangedEventHandler = Global.Access <GpuSpeedChangedEvent>(
                Guid.Parse("2cb8adb2-1e7e-433e-8904-ae71d9563c20"),
                "显卡算力变更后刷新算力图界面",
                LogEnum.None,
                action: (message) => {
                Execute.OnUIThread(() => {
                    if (mainCoinId != NTMinerRoot.Current.MinerProfile.CoinId)
                    {
                        mainCoinId = NTMinerRoot.Current.MinerProfile.CoinId;
                        foreach (var speedChartVm in Vm.SpeedChartVms)
                        {
                            SeriesCollection series       = speedChartVm.Series;
                            SeriesCollection seriesShadow = speedChartVm.SeriesShadow;
                            foreach (var item in series)
                            {
                                item.Values.Clear();
                            }
                            foreach (var item in seriesShadow)
                            {
                                item.Values.Clear();
                            }
                        }
                    }
                    IGpuSpeed gpuSpeed = message.Source;
                    int index          = gpuSpeed.Gpu.Index;
                    if (Vm.SpeedChartVms.ContainsKey(index))
                    {
                        SpeedChartViewModel speedChartVm = Vm.SpeedChartVms[index];
                        SeriesCollection series          = speedChartVm.Series;
                        SeriesCollection seriesShadow    = speedChartVm.SeriesShadow;
                        DateTime now = DateTime.Now;
                        if (gpuSpeed.MainCoinSpeed != null && series.Count > 0)
                        {
                            IChartValues chartValues = series[0].Values;
                            chartValues.Add(new MeasureModel()
                            {
                                DateTime = gpuSpeed.MainCoinSpeed.SpeedOn,
                                Value    = gpuSpeed.MainCoinSpeed.Value
                            });
                            if (((MeasureModel)chartValues[0]).DateTime.AddMinutes(NTMinerRoot.Current.SpeedHistoryLengthByMinute) < now)
                            {
                                chartValues.RemoveAt(0);
                            }
                            chartValues = seriesShadow[0].Values;
                            chartValues.Add(new MeasureModel()
                            {
                                DateTime = gpuSpeed.MainCoinSpeed.SpeedOn,
                                Value    = gpuSpeed.MainCoinSpeed.Value
                            });
                            if (((MeasureModel)chartValues[0]).DateTime.AddMinutes(NTMinerRoot.Current.SpeedHistoryLengthByMinute) < now)
                            {
                                chartValues.RemoveAt(0);
                            }
                        }
                        if (gpuSpeed.DualCoinSpeed != null && series.Count > 1)
                        {
                            IChartValues chartValues = series[1].Values;
                            chartValues.Add(new MeasureModel()
                            {
                                DateTime = gpuSpeed.DualCoinSpeed.SpeedOn,
                                Value    = gpuSpeed.DualCoinSpeed.Value
                            });
                            if (((MeasureModel)chartValues[0]).DateTime.AddMinutes(NTMinerRoot.Current.SpeedHistoryLengthByMinute) < now)
                            {
                                chartValues.RemoveAt(0);
                            }
                            chartValues = seriesShadow[1].Values;
                            chartValues.Add(new MeasureModel()
                            {
                                DateTime = gpuSpeed.DualCoinSpeed.SpeedOn,
                                Value    = gpuSpeed.DualCoinSpeed.Value
                            });
                            if (((MeasureModel)chartValues[0]).DateTime.AddMinutes(NTMinerRoot.Current.SpeedHistoryLengthByMinute) < now)
                            {
                                chartValues.RemoveAt(0);
                            }
                        }

                        speedChartVm.SetAxisLimits(now);
                    }
                });
            });

            Vm.ItemsPanelColumns = 1;
            this.Unloaded       += (object sender, RoutedEventArgs e) => {
                Global.UnAccess(gpuSpeedChangedEventHandler);
                foreach (var item in Vm.SpeedChartVms)
                {
                    item.Series       = null;
                    item.SeriesShadow = null;
                    item.AxisX        = null;
                    item.AxisY        = null;
                    item.AxisXShadow  = null;
                    item.AxisYShadow  = null;
                }
                _chartDic.Clear();
            };
            SolidColorBrush White = new SolidColorBrush(Colors.White);

            Vm.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
                if (e.PropertyName == nameof(Vm.CurrentSpeedChartVm))
                {
                    SpeedChartViewModel currentItem = Vm.CurrentSpeedChartVm;
                    if (currentItem != null)
                    {
                        foreach (var item in _chartDic.Values)
                        {
                            item.Visibility = Visibility.Collapsed;
                        }
                        CartesianChart chart;
                        if (!_chartDic.ContainsKey(currentItem))
                        {
                            chart = new CartesianChart()
                            {
                                DisableAnimations = true,
                                Hoverable         = false,
                                DataTooltip       = null,
                                Background        = White,
                                Padding           = new Thickness(4, 0, 0, 0),
                                Visibility        = Visibility.Visible
                            };
                            chart.Series = currentItem.SeriesShadow;
                            chart.AxisX  = currentItem.AxisXShadow;
                            chart.AxisY  = currentItem.AxisYShadow;
                            _chartDic.Add(currentItem, chart);
                            DetailsGrid.Children.Add(chart);
                        }
                        else
                        {
                            chart            = _chartDic[currentItem];
                            chart.Visibility = Visibility.Visible;
                        }
                    }
                }
            };

            Vm.SetCurrentSpeedChartVm(Vm.SpeedChartVms.FirstOrDefault());

            if (MinerProfileViewModel.Current.CoinVm != null)
            {
                Guid coinId = MinerProfileViewModel.Current.CoinId;
                foreach (var item in NTMinerRoot.Current.GpuSet)
                {
                    List <IGpuSpeed>    gpuSpeedHistory = item.GetGpuSpeedHistory();
                    SpeedChartViewModel speedChartVm    = Vm.SpeedChartVms[item.Index];
                    SeriesCollection    series          = speedChartVm.Series;
                    SeriesCollection    seriesShadow    = speedChartVm.SeriesShadow;
                    DateTime            now             = DateTime.Now;
                    foreach (var gpuSpeed in gpuSpeedHistory)
                    {
                        if (gpuSpeed.MainCoinSpeed != null && series.Count > 0)
                        {
                            series[0].Values.Add(new MeasureModel()
                            {
                                DateTime = gpuSpeed.MainCoinSpeed.SpeedOn,
                                Value    = gpuSpeed.MainCoinSpeed.Value
                            });
                            seriesShadow[0].Values.Add(new MeasureModel()
                            {
                                DateTime = gpuSpeed.MainCoinSpeed.SpeedOn,
                                Value    = gpuSpeed.MainCoinSpeed.Value
                            });
                        }
                        if (gpuSpeed.DualCoinSpeed != null && series.Count > 1)
                        {
                            series[0].Values.Add(new MeasureModel()
                            {
                                DateTime = gpuSpeed.DualCoinSpeed.SpeedOn,
                                Value    = gpuSpeed.DualCoinSpeed.Value
                            });
                            seriesShadow[0].Values.Add(new MeasureModel()
                            {
                                DateTime = gpuSpeed.DualCoinSpeed.SpeedOn,
                                Value    = gpuSpeed.DualCoinSpeed.Value
                            });
                        }
                    }
                    IChartValues values = series[0].Values;
                    if (values.Count > 0 && ((MeasureModel)values[0]).DateTime.AddMinutes(NTMinerRoot.Current.SpeedHistoryLengthByMinute) < now)
                    {
                        series[0].Values.RemoveAt(0);
                    }
                    values = seriesShadow[0].Values;
                    if (values.Count > 0 && ((MeasureModel)values[0]).DateTime.AddMinutes(NTMinerRoot.Current.SpeedHistoryLengthByMinute) < now)
                    {
                        seriesShadow[0].Values.RemoveAt(0);
                    }
                    speedChartVm.SetAxisLimits(now);
                }
            }
        }
Example #7
0
        private void start(Period currentPeriod, Period sourcePeriod, IEventPublisher publisher)
        {
            basicDataCopyingProgress.State = new PeriodBasicDataCopying();
            basicDataCopyingProgress.Messages.Add("شروع کپی دوره");
            var preState = currentPeriod.State;
            publisher.OnHandlerError(exp => { basicDataCopyingProgress.Messages.Add(exp.Message); });
            copyCompletedSub = new DelegateHandler<CopyBasicDataCompleted>(
                p =>
                {
                    var srvManagerPeriod = periodServiceFactory.Create();
                    try
                    {
                        var ps = srvManagerPeriod.GetService();
                        ps.CompleteCopyingBasicData(currentPeriod.Id, preState);
                    }
                    finally
                    {
                        IsCopying = false;
                        basicDataCopyingProgress = new BasicDataCopyingProgress();
                        periodServiceFactory.Release(srvManagerPeriod);
                    }
                });
            publisher.RegisterHandler(copyCompletedSub);

            try
            {
                BasicDataCopyingProgress.SetProgress(100, 5);
                deleteAllPeriodData(currentPeriod);
                basicDataCopyingProgress.Messages.Add("اطلاعات پایه پیشین پاک شد.");

                basicDataCopyingProgress.SetProgress(100, 25);
                copyUnits(sourcePeriod, currentPeriod);
                basicDataCopyingProgress.Messages.Add("کپی واحد های سازمانی انجام شد.");


                basicDataCopyingProgress.SetProgress(100, 35);
                copyPeriodJobIndices(sourcePeriod, currentPeriod);
                basicDataCopyingProgress.Messages.Add("کپی شاخص ها انجام شد.");

                basicDataCopyingProgress.SetProgress(100, 45);
                copyJobs(sourcePeriod, currentPeriod);
                basicDataCopyingProgress.Messages.Add("کپی شغل ها انجام شد.");
                basicDataCopyingProgress.SetProgress(100, 65);

                copyJobPositions(sourcePeriod, currentPeriod);
                basicDataCopyingProgress.Messages.Add("کپی پست ها انجام شد.");
                basicDataCopyingProgress.SetProgress(100, 100);
                basicDataCopyingProgress.Messages.Add("اتمام عملیات کپی دوره.");
                lastPeriod=new KeyValuePair<PeriodId,List<string>>(currentPeriod.Id, basicDataCopyingProgress.Messages);
                publisher.Publish(new CopyBasicDataCompleted(currentPeriod,preState));
            }
            catch (Exception ex)
            {
                basicDataCopyingProgress.Messages.Add("خطا در کپی اطلاعات " + ex.Message);
                var logServiceMngt = LogServiceFactory.Create();
                try
                {
                    var logService = logServiceMngt.GetService();
                    logService.AddEventLog("Copy Exception",
                        LogLevel.Error,
                        null, this.GetType().Name, "start", ex.Message, ex.StackTrace);
                    logService.AddExceptionLog(ex);
                }
                finally
                {
                    LogServiceFactory.Release(logServiceMngt);
                }
                IsCopying = false;
                basicDataCopyingProgress = new BasicDataCopyingProgress();
            }
        }
Example #8
0
 public WebApiSubstitute(DelegateHandler apiMessageHandler)
 {
     _apiMessageHandler = apiMessageHandler;
     StartWebApiSubstitute();
 }
Example #9
0
        public async Task evicts_503_handlers_temporarily()
        {
            var activeHandler = new DelegateHandler((message, token) => Task.FromResult(new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent("active")
            }));
            int timedOut     = 0;
            var retryHandler = new DelegateHandler((message, token) =>
            {
                if (Interlocked.Exchange(ref timedOut, 1) == 0)
                {
                    return(Task.FromResult(new HttpResponseMessage()
                    {
                        StatusCode = HttpStatusCode.ServiceUnavailable,
                        Headers = { RetryAfter = new RetryConditionHeaderValue(TimeSpan.FromSeconds(5)) }
                    }));
                }
                return(Task.FromResult(new HttpResponseMessage()
                {
                    StatusCode = HttpStatusCode.OK,
                    Content = new StringContent("reactivated")
                }));
            });
            var handlerIndex = 0;
            var factory      = new RoundRobinHttpClientFactory(2, () => handlerIndex++ *2 == 0 ? activeHandler : retryHandler);

            var responsesBefore = await execute();

            await Task.Delay(TimeSpan.FromSeconds(6));

            var responsesAfter = await execute();

            responsesBefore.Count(r => r.response.StatusCode == HttpStatusCode.ServiceUnavailable).ShouldBe(1);
            responsesBefore.Any(r => r.content == "reactivated").ShouldBeFalse();

            responsesAfter.All(r => r.response.StatusCode == HttpStatusCode.OK).ShouldBeTrue();
            responsesAfter.Count(r => r.content == "reactivated").ShouldBe(5);
            responsesAfter.Count(r => r.content == "active").ShouldBe(5);


            async Task <List <(HttpResponseMessage response, string content)> > execute()
            {
                List <(HttpResponseMessage httpResponseMessage, string content)> response = new List <(HttpResponseMessage httpResponseMessage, string content)>();

                for (int i = 0; i < 10; i++)
                {
                    using (var client = factory.GetClient())
                    {
                        var httpResponseMessage = await client.SendAsync(new HttpRequestMessage(HttpMethod.Get, "http://nowhere.example/path"));

                        var content = httpResponseMessage.Content == null
              ? null
              : await httpResponseMessage.Content?.ReadAsStringAsync();

                        response.Add((httpResponseMessage, content));
                    }
                }

                return(response);
            }
        }
Example #10
0
        private void registerHandler()
        {
            #region UnitIndex Converter handler

            unitIndexConvertedHandler = new DelegateHandler <UnitIndexConverted>(e =>
            {
                unitIndexInperiodList = e.UnitIndexInperiodList;
                Console.WriteLine("{0} Converted , Unit index progress finished", unitIndexInperiodList.Count);
                unitConverter.ConvertUnits(period, unitIndexInperiodList);
            });
            publisher.RegisterHandler(unitIndexConvertedHandler);

            #endregion

            #region Unit Converter handler

            unitConvertedHandler = new DelegateHandler <UnitConverted>(e =>
            {
                unitList = e.UnitList;
                Console.WriteLine("{0} Units converted , Unit progress finished", e.UnitList.Count);
                jobIndexConverter.ConvertJobIndex(period);
            });
            publisher.RegisterHandler(unitConvertedHandler);

            #endregion

            #region JobIndex Converter handler

            jobIndexConvertedHandler = new DelegateHandler <JobIndexConverted>(e =>
            {
                jobIndexInperiodList = e.JobIndexInperiodList;
                jobIndexList         = e.JobIndexList;
                Console.WriteLine("{0} Job index converted , Job index progress finished", jobIndexInperiodList.Count);
                jobConverter.ConvertJobs(period, jobIndexInperiodList, jobIndexList);
            });
            publisher.RegisterHandler(jobIndexConvertedHandler);

            #endregion

            #region Job Conveter Handler

            jobConvertedHandler = new DelegateHandler <JobConverted>(e =>
            {
                jobList = e.JobList;
                Console.WriteLine("{0} Jobs Converted , Job progress finished", e.JobList.Count);
                jobPositionConverter.ConvertJobPositions(period, unitList, jobList);
            });
            publisher.RegisterHandler(jobConvertedHandler);

            #endregion

            #region JobPosition Conveter Handler

            jobPositionConvertedHandler = new DelegateHandler <JobPositionConverted>(e =>
            {
                jobPositionList = e.JobPositionList;
                Console.WriteLine("{0} JobPositions Converted , JobPosition progress finished", e.JobPositionList.Count);
                employeeConverter.ConvertEmployees(period, jobPositionList);
            });
            publisher.RegisterHandler(jobPositionConvertedHandler);

            #endregion
        }
Example #11
0
 public static void UnAccess <TMessage>(DelegateHandler <TMessage> handler)
 {
     MessageDispatcher.UnRegister(handler);
 }
Example #12
0
        private void start(Calculation calculation, bool doResume)
        {
            long totalCalcOperationCount   = 0;
            long preCalcOperationDoneCount = 0;

            calculatorSession = new CalculatorSession {
                PathNo = 1
            };
            if (doResume)
            {
                var calcResult = calculation.CalculationResult;
                foreach (string s in calcResult.Messages)
                {
                    messages.Add(s);
                }
                messages.Add("=====================================================");
                totalCalcOperationCount   = calcResult.TotalEmployeesCount;
                preCalcOperationDoneCount = calcResult.EmployeesCalculatedCount;
                progress.SetProgress(totalCalcOperationCount, preCalcOperationDoneCount);
                if (calcResult.LastCalculatedPath.HasValue)
                {
                    progress.SetLastCalculatedEmployee(calcResult.LastCalculatedEmployeeId, calcResult.LastCalculatedPath.Value);
                    calculatorSession.PathNo = calcResult.LastCalculatedPath.Value;
                }
                var engine = calculatorEngineFactory.Create();
                try
                {
                    calculatorSession.AddCalculationPoints(engine.GetCalculationPiontBy(calculation.Id));
                }
                finally
                {
                    calculatorEngineFactory.Release(engine);
                }
            }

            Policy policy = null;

            messages.Add(DateTime.Now + "شروع محاسبه  ");
            try
            {
                startTrigger.Set();
                CalculationCompletedSub = new DelegateHandler <CalculationCompleted>(e =>
                {
                    var engine = calculatorEngineFactory.Create();
                    try
                    {
                        engine.AddUpdateCalculationPoint(calculatorSession.CalculationPoints);
                        engine.UpdateCalculationResult(calculation, progress, this, messages);
                    }
                    finally
                    {
                        calculatorEngineFactory.Release(engine);
                    }
                });
                publisher.RegisterHandler(CalculationCompletedSub);

                rulsCompiledSub = new DelegateHandler <RulesCompiled>(e =>
                {
                    if (!doResume)
                    {
                        Task.Factory.StartNew(() =>
                        {
                            var engine = calculatorEngineFactory.Create();
                            try
                            {
                                engine.UpdateCompileResult(calculation.Id, e.CompileResult.LibraryText, e.Rules);
                            }
                            finally
                            {
                                calculatorEngineFactory.Release(engine);
                            }

                            messages.Add(DateTime.Now + "  قوانین کامپایل شدند");
                        });
                    }
                });
                publisher.RegisterHandler(rulsCompiledSub);

                publisher.RegisterHandler <JobIndexPointsReady>(jobIndexPointPersister);
                publisher.RegisterHandler <CalculationExceptionReady>(calculationExceptionPersister);
                publisher.RegisterHandler <CalculationCompleted>(jobIndexPointPersister);
                publisher.RegisterHandler <CalculationCompleted>(calculationExceptionPersister);
                publisher.RegisterHandler <CalculationForPathCompleted>(jobIndexPointPersister);
                publisher.RegisterHandler <PathPersisteCompleted>(this);

                Dictionary <int, IList <Employee> > employeesWithPath;
                Period period;
                fetchPolicyAndEmployees(calculation, doResume, calculatorSession.PathNo, out policy, out employeesWithPath, out period);
                deleteCalculationException(calculation);

                long currentCalcOperationCount = 0;
                foreach (var employees in employeesWithPath)
                {
                    currentCalcOperationCount = currentCalcOperationCount + employees.Value.Count();
                }

                if (!doResume)
                {
                    totalCalcOperationCount = currentCalcOperationCount;
                    progress.SetProgress(totalCalcOperationCount, 0);
                }

                messages.Add(DateTime.Now + "  تعداد " + currentCalcOperationCount + " عملیات محاسبه برای  " + calculation.EmployeeCount + " کارمند آماده می باشد");

                var currentCalcOperationDoneCount = preCalcOperationDoneCount;
                var pathCount = employeesWithPath.Count();

                foreach (var emlpoyees in employeesWithPath)
                {
                    calculatorSession.PathNo = emlpoyees.Key;

                    foreach (var employee in emlpoyees.Value)
                    {
                        try
                        {
                            if (doStop || doPause)
                            {
                                break;
                            }

                            var pointsHolder = calculateIndices(calculation, policy, period, employee, calculatorSession);
                            currentCalcOperationDoneCount++;
                            progress.SetProgress(totalCalcOperationCount, currentCalcOperationDoneCount);
                            addOrUpdateCalculationPoints(pointsHolder.CalculationPoints);
                            publisher.Publish(new JobIndexPointsReady(pointsHolder, calculation.Id, employee.Id, calculatorSession.PathNo));
                            progress.SetLastCalculatedEmployee(employee.Id, calculatorSession.PathNo);
                        }
                        catch (Exception ex)
                        {
                            publisher.Publish(new CalculationExceptionReady(calculation.Id, employee.Id, calculatorSession.PathNo, ex));
                            calculatorSession.HasEmployeeCalculationFailed = true;
                            messages.Add("*** خطا در محاسبه شاخص های کارمند " + employee.Id.EmployeeNo + " **** ");
                            var logServiceMngt = LogServiceFactory.Create();
                            try
                            {
                                var logService = logServiceMngt.GetService();
                                logService.AddEventLog("JobIndexPointCalculator_EmpId:" + employee.Id.EmployeeNo,
                                                       LogLevel.Error,
                                                       null, this.GetType().Name, "start", ex.Message, ex.StackTrace);
                                logService.AddExceptionLog(ex);
                            }
                            finally
                            {
                                LogServiceFactory.Release(logServiceMngt);
                            }
                        }
                    }

                    if (pathCount > calculatorSession.PathNo)
                    {
                        publisher.Publish(new CalculationForPathCompleted());
                        pathPersisterTrigger.WaitOne();
                    }

                    if (calculatorSession.HasEmployeeCalculationFailed)
                    {
                        break;
                    }
                }

                messages.Add(DateTime.Now + "  تعداد " + currentCalcOperationDoneCount + " عملیات محاسبه انجام شد");
                if (!(doStop || doPause))
                {
                    publisher.Publish(new CalculationCompleted());
                }
                else if (doStop)
                {
                    messages.Add(DateTime.Now + "  لغو محاسبه.");
                }
                else if (doPause)
                {
                    messages.Add(DateTime.Now + "  وقفه در محاسبه.");
                }
                if (doPause || doStop)
                {
                    var engine = calculatorEngineFactory.Create();
                    try
                    {
                        engine.AddUpdateCalculationPoint(calculatorSession.CalculationPoints);
                    }
                    finally
                    {
                        calculatorEngineFactory.Release(engine);
                    }
                }
                pauseTrigger.Set();
            }
            catch (Exception e)
            {
                startTrigger.Set();
                calculatorSession.HasEmployeeCalculationFailed = true;
                messages.Add(DateTime.Now + "در آماده سازی محاسبه با مشکل مواجه شده است");
                publisher.Publish(new CalculationCompleted());
            }
            finally
            {
                state = CalculatorState.Completed;
                if (policy != null)
                {
                    policy.Dispose();
                }
            }
        }
Example #13
0
 public void RegisterHandler(DelegateHandler registerTheMethod)
 {
     listOfHandlers = registerTheMethod;
 }
 public void DestroyBox()
 {
     DelegateHandler.BoxDestroyed(parentHolder.ColumnType, parentHolder.BoxType);
     Destroy(transform.parent.gameObject);
 }