Пример #1
0
        private string getExportDirectory(ParameterIdentification parameterIdentification)
        {
            var path = _dialogCreator.AskForFolder(Captions.ParameterIdentification.SelectDirectoryForParameterIdentificationExport, Constants.DirectoryKey.SIM_MODEL_XML);

            if (string.IsNullOrEmpty(path))
            {
                return(path);
            }

            var newDirectoryName = parameterIdentification.Name;

            path = Path.Combine(path, newDirectoryName);

            if (!DirectoryHelper.DirectoryExists(path))
            {
                return(DirectoryHelper.CreateDirectory(path));
            }

            if (_dialogCreator.MessageBoxYesNo(Captions.DoYouWantToDeleteDirectory(newDirectoryName), Captions.Delete, Captions.Cancel) == ViewResult.No)
            {
                return(string.Empty);
            }

            DirectoryHelper.DeleteDirectory(path, true);
            return(DirectoryHelper.CreateDirectory(path));
        }
        public bool Delete(IEnumerable <DataRepository> observedDataToBeRemoved)
        {
            var observedDataToRemoveList = observedDataToBeRemoved.ToList();

            var usedInAnalyzablesCache = new Cache <DataRepository, IEnumerable <IUsesObservedData> >();

            observedDataToRemoveList.Each(x =>
            {
                usedInAnalyzablesCache[x] = allUsersOfObservedData(x);
            });

            var observedDataThatCanBeRemoved  = observedDataToRemoveList.Where(x => !usedInAnalyzablesCache[x].Any()).ToList();
            var observedDataNotDeleted        = observedDataToRemoveList.Except(observedDataThatCanBeRemoved);
            var observedDataNotDeletedMessage = observedDataNotDeleted.Select(x => messageForObservedDataUsedByAnalysable(x, usedInAnalyzablesCache));

            //not one observed data can be deleted because all of them are used
            if (!observedDataThatCanBeRemoved.Any())
            {
                throw new CannotDeleteObservedDataException(observedDataNotDeletedMessage);
            }


            var viewResult = _dialogCreator.MessageBoxYesNo(Captions.ReallyDeleteAllObservedData(observedDataNotDeletedMessage));

            if (viewResult == ViewResult.No)
            {
                return(false);
            }

            return(deleteAll(observedDataThatCanBeRemoved));
        }
Пример #3
0
        public IPKSimBuildingBlock CreateCloneFor(IPKSimBuildingBlock buildingBlockToClone)
        {
            //This should never fail
            var expressionProfile = buildingBlockToClone.DowncastTo <ExpressionProfile>();

            var(molecule, _) = expressionProfile;
            _dto             = _expressionProfileDTOMapper.MapFrom(expressionProfile);
            _view.Caption    = Captions.CloneObjectBase(PKSimConstants.ObjectTypes.ExpressionProfile, buildingBlockToClone.Name);

            _view.BindTo(_dto);
            _view.Display();

            if (_view.Canceled)
            {
                return(null);
            }

            //create a new expression profile using the same molecule name as the original so that we can update the values. Then we rename
            var newExpressionProfile = _expressionProfileFactory.Create(molecule.MoleculeType, _dto.Species.Name, molecule.Name);

            newExpressionProfile.Category = _dto.Category;

            //synchronize values
            _expressionProfileUpdater.SynchronizeExpressionProfileWithExpressionProfile(expressionProfile, newExpressionProfile);

            //rename using the new name
            _expressionProfileUpdater.UpdateMoleculeName(newExpressionProfile, _dto.MoleculeName);

            return(newExpressionProfile);
        }
        private string getExportPath()
        {
            var folder = _dialogCreator.AskForFolder(Captions.ParameterIdentification.SelectDirectoryForParameterIdentificationExport, Constants.DirectoryKey.REPORT);

            if (string.IsNullOrEmpty(folder))
            {
                return(string.Empty);
            }

            var newDirectoryName = Subject.Name;

            folder = Path.Combine(folder, newDirectoryName);

            if (!DirectoryHelper.DirectoryExists(folder))
            {
                return(DirectoryHelper.CreateDirectory(folder));
            }

            if (_dialogCreator.MessageBoxYesNo(Captions.DoYouWantToDeleteDirectory(newDirectoryName), Captions.Delete, Captions.Cancel, defaultButton: ViewResult.No) == ViewResult.No)
            {
                return(string.Empty);
            }

            DirectoryHelper.DeleteDirectory(folder, true);
            return(DirectoryHelper.CreateDirectory(folder));
        }
Пример #5
0
        protected override void Execute(CodeActivityContext context)
        {
            try
            {
                string _Captions = Captions.Get(context);
                string _Text     = Text.Get(context);

                if (_Captions == "")
                {
                    _Captions = "RPAStudio";
                }

                if (Buttons > 1)
                {
                    Buttons++;
                }

                MessageBoxOptions mo;
                if (TopMost)
                {
                    mo = MessageBoxOptions.DefaultDesktopOnly;
                }
                else
                {
                    mo = MessageBoxOptions.None;
                }
                var result = MessageBox.Show(_Text, _Captions, (MessageBoxButton)Buttons, MessageBoxImage.None, MessageBoxResult.None, mo);

                ChosenButton.Set(context, result.ToString());
            }
            catch (Exception e)
            {
                SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", e.Message);
            }
        }
Пример #6
0
        public TObjectBase CreateCloneFor(TObjectBase objectToClone)
        {
            var entityType = _objectTypeResolver.TypeFor(objectToClone);

            _view.Caption         = Captions.ParameterIdentification.Clone;
            _view.NameDescription = Captions.CloneObjectBase(entityType, objectToClone.Name);
            _view.Icon            = ApplicationIcons.Clone;
            _renameObjectBaseDTO  = _renameObjectBaseDTOFactory.CreateFor(objectToClone);
            _renameObjectBaseDTO.AllowSameNameAsOriginalInDifferentCase = false;
            _renameObjectBaseDTO.Description = objectToClone.Description;
            _view.BindTo(_renameObjectBaseDTO);
            _view.Display();

            if (_view.Canceled)
            {
                return(null);
            }

            var clonedObject = Clone(objectToClone);

            clonedObject.Name        = _renameObjectBaseDTO.Name;
            clonedObject.Description = _renameObjectBaseDTO.Description;

            return(clonedObject);
        }
Пример #7
0
        protected override void InitializeResourcesFor(IWithName namedObject)
        {
            string entityType = _entityType ?? _objectTypeResolver.TypeFor(namedObject);

            _view.Caption         = Captions.Rename;
            _view.NameDescription = Captions.RenameEntityCaption(entityType, namedObject.Name);
        }
Пример #8
0
        protected override void InitializeResourcesFor(IObjectBase entity)
        {
            string entityType = _objectTypeResolver.TypeFor(entity);

            _view.Caption         = Captions.EditDescription;
            _view.NameDescription = Captions.RenameEntityCaption(entityType, entity.Name);
            _view.Icon            = ApplicationIcons.Description;
        }
 public ClosedCaption this[string key]
 {
     get
     {
         var hash = Crc32.Compute(Encoding.UTF8.GetBytes(key));
         return(Captions.Find(caption => caption.Hash == hash));
     }
 }
Пример #10
0
 public void Initialize(string caption, ApplicationIcon icon, string issueTrackerUrl, string productName)
 {
     Text                  = caption;
     Icon                  = icon;
     _issueTrackerUrl      = issueTrackerUrl;
     Description           = Captions.ExceptionViewDescription(issueTrackerUrl, html: false);
     issueTrackerLink.Text = Captions.IssueTrackerLinkFor(productName);
 }
 /// <summary>
 /// Clears this instance.
 /// </summary>
 public void Clear()
 {
     lock (this)
     {
         Properties.Clear();
         Captions.Clear();
         Captions.Capacity = 0;
     }
 }
Пример #12
0
        public static string ExceptionMessage(this Exception ex)
        {
            if (IsWrapperException(ex))
            {
                return(ExceptionMessage(ex.InnerException));
            }

            return($"{ex.FullMessage()}{Environment.NewLine}{Environment.NewLine}{Captions.ContactSupport(Constants.FORUM_SITE)}");
        }
Пример #13
0
 public Caption(string captionText, int captionRow, int captionCol)
 {
     InitializeComponent();
     this.captionLabel.Text = captionText;
     this.row = captionRow;
     this.col = captionCol;
     Captions.Add(this);
     mainForm.Controls.Add(this);
     SetPosition();
 }
 /// <summary>
 /// Clears the specified caption.
 /// </summary>
 /// <param name="caption">The caption.</param>
 /// <param name="property">The property.</param>
 public void Clear(String caption, String property)
 {
     lock (this)
     {
         if (Captions.Contains(caption))
         {
             Properties[caption].Remove(property);
         }
     }
 }
Пример #15
0
        public Caption NextCaption(Caption caption)
        {
            var idx = Captions.IndexOf(caption);

            if (idx >= Captions.Count - 1)
            {
                return(null);
            }

            return(Captions[idx + 1]);
        }
Пример #16
0
        public Caption PreviousCaption(Caption caption)
        {
            var idx = Captions.IndexOf(caption);

            if (idx == 0)
            {
                return(null);
            }

            return(Captions[idx - 1]);
        }
Пример #17
0
        private void bindCurveChartToEditor()
        {
            Chart = new CurveChart
            {
                OriginText = Captions.ChartFingerprintDataFrom("Test Chart Project", "Test Chart Simulation", DateTime.Now.ToIsoFormat()),
                Title      = "The Chart Title"
            };

            Chart.ChartSettings.BackColor = Color.White;
            ChartEditorPresenter.Edit(Chart);
        }
 /// <summary>
 /// Clears the specified caption.
 /// </summary>
 /// <param name="caption">The caption.</param>
 public void Clear(String caption)
 {
     lock (this)
     {
         if (Captions.Contains(caption))
         {
             Captions.Remove(caption);
             Properties.Remove(caption);
         }
     }
 }
        private void OnDeleteCaption(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            if (btn != null)
            {
                ClosedCaptionDependencyObject obj = btn.CommandParameter as ClosedCaptionDependencyObject;
                if (obj != null)
                {
                    Captions.Remove(obj);
                }
            }
        }
        /// <summary>
        /// Adds the specified caption.
        /// </summary>
        /// <param name="caption">The caption.</param>
        /// <param name="nvcollection">The nvcollection.</param>
        public void Add(String caption, NameValueCollection nvcollection)
        {
            lock (this)
            {
                if (!Captions.Contains(caption))
                {
                    Captions.Add(caption);
                    Properties.Add(caption, new NameValueCollection());
                }

                Properties[caption].Add(nvcollection);
            }
        }
        /// <summary>
        /// Adds the specified caption.
        /// </summary>
        /// <param name="caption">The caption.</param>
        /// <param name="property">The property.</param>
        /// <param name="value">The value.</param>
        public void Add(String caption, String property, String value)
        {
            lock (this)
            {
                if (!Captions.Contains(caption))
                {
                    Captions.Add(caption);
                    Properties.Add(caption, new NameValueCollection());
                }

                Properties[caption][property] = value;
            }
        }
Пример #22
0
        public void CheckWatermarkStatus()
        {
            //Value defined, nothing to do
            if (_applicationSettings.UseWatermark.HasValue)
            {
                return;
            }

            var useWatermark = _dialogCreator.MessageBoxYesNo(
                Captions.ShouldWatermarkBeUsedForChartExportToClipboard(_applicationConfiguration.ProductName, _applicationConfiguration.WatermarkOptionLocation),
                defaultButton: ViewResult.No);

            _applicationSettings.UseWatermark = (useWatermark == ViewResult.Yes);
        }
 public void Edit(DisplayUnitsManager displayUnitsManager, string displayUnitsType)
 {
     _displayUnitsManagerToEdit = displayUnitsManager;
     _clonedUnitManager         = _cloner.Clone(_displayUnitsManagerToEdit);
     _displayUnitsPresenter.Edit(_clonedUnitManager);
     _view.Caption = Captions.ManageDisplayUnits(displayUnitsType);
     _view.Display();
     if (_view.Canceled)
     {
         return;
     }
     // User confirms changes=> Update
     _displayUnitsManagerToEdit.UpdatePropertiesFrom(_clonedUnitManager, _cloner);
 }
    IEnumerator UploadImage(Texture2D tex, string formtext)
    {
        //Texture2D tex_to_send = DeCompress(tex);
        var bytes = tex.EncodeToJPG();

        //File.WriteAllBytes(Application.dataPath + "/../SavedScreen.jpg", bytes);
        Debug.Log(bytes.Length);
        string  encodedText = Convert.ToBase64String(bytes);
        WWWForm form        = new WWWForm();

        form.AddField("file", encodedText);
        form.AddField("text", formtext);
        // HTTPリクエストを送る
        UnityWebRequest request = UnityWebRequest.Post(serverAddress, form);

        yield return(request.SendWebRequest());

        if (request.isNetworkError)
        {
            // POSTに失敗した場合,エラーログを出力
            Debug.Log(request.error);
        }
        else
        {
            // POSTに成功した場合,レスポンスコードを出力
            Debug.Log(request.responseCode);
            if (request.responseCode == 200)
            {
                // Debug.Log(request.downloadHandler.text);
                string   responseText = request.downloadHandler.text;
                Captions captions     = null;
                try {
                    captions = JsonUtility.FromJson <Captions>(responseText);
                } catch (Exception e) {
                    Debug.Log(e);
                }
                if (captions != null)
                {
                    phraseManager.UpdatePhrase(captions.caption);
                }
                foreach (string cap in captions.caption)
                {
                    Debug.Log(cap);
                }
                // var resList = Serialization.CreateFromJSON(responseText);
                // text.text = resList.message;
            }
        }
    }
Пример #25
0
        public void SetPosition()
        {
            int formWidth = mainForm.ClientRectangle.Width, formHeight = mainForm.ClientRectangle.Height - 10;
            int x = formWidth / IAP.MaxCols * (col - 1), y = 0;

            foreach (var iap in IAP.IAPs.Values.Where(o => (o.col == col) && (o.row < row)))
            {
                y += ((IAP)iap).CalculateHeight() + 5;
            }

            foreach (var caption in Captions.Where(o => (o.col == col) && (o.row < row)))
            {
                y += ((Caption)caption).Height;
            }

            this.Width = formWidth / IAP.MaxCols;
            this.captionLabel.Width = this.Width;
            this.Location           = new Point(x, y);
        }
        public bool Delete(DataRepository observedData)
        {
            var usersOfObservedData = allUsersOfObservedData(observedData).ToList();

            if (usersOfObservedData.Any())
            {
                throw new CannotDeleteObservedDataException(observedData.Name, usersOfObservedData.Select(typeNamed).ToList());
            }

            var viewResult = _dialogCreator.MessageBoxYesNo(Captions.ReallyDeleteObservedData(observedData.Name));

            if (viewResult == ViewResult.No)
            {
                return(false);
            }

            var removeCommand = new RemoveObservedDataFromProjectCommand(observedData).Run(_executionContext);

            _executionContext.AddToHistory(removeCommand);
            return(true);
        }
 internal API.Models.GfyParameters CreateModel()
 {
     return(new API.Models.GfyParameters()
     {
         Captions = Captions?.Select(cap => (cap == null) ? null : new API.Models.Caption()
         {
             Duration = cap.Duration,
             FontHeight = cap.FontHeight,
             RelativeFontHeight = cap.RelativeFontHeight,
             RelativeX = cap.RelativeXPosition,
             RelativeY = cap.RelativeYPosition,
             StartSeconds = cap.StartSeconds,
             Text = cap.Text,
             X = cap.XPosition,
             Y = cap.YPosition,
         }),
         Crop = (Crop == null) ? null : new API.Models.Crop()
         {
             H = Crop.Height,
             W = Crop.Width,
             X = Crop.XPosition,
             Y = Crop.YPosition
         },
         Cut = (Cut == null) ? null : new API.Models.Cut()
         {
             Duration = Cut.Duration,
             Start = Cut.Start
         },
         Description = Description,
         FetchHours = FetchHours,
         FetchMinutes = FetchMinutes,
         FetchSeconds = FetchSeconds,
         FetchUrl = FetchUrl,
         NoMd5 = NoMd5,
         Nsfw = Nsfw,
         Private = Private,
         Tags = Tags,
         Title = Title
     });
 }
Пример #28
0
        public void InitializeChartFromTemplate(CurveChart chart, IEnumerable <DataColumn> dataColumns, CurveChartTemplate template,
                                                Func <DataColumn, string> curveNameDefinition = null,
                                                bool warnIfNumberOfCurvesAboveThreshold       = false,
                                                bool propogateChartChangeEvent = true,
                                                int warningThreshold           = Constants.DEFAULT_TEMPLATE_WARNING_THRESHOLD)
        {
            try
            {
                _allColumnsByPath    = dataColumns.Select(x => new ColumnPath(x)).ToList();
                _curveNameDefinition = curveNameDefinition ?? (x => x.Name);

                //Retrieve all possible curves for each curve template defined in the given template
                var curvesForTemplates = new Cache <CurveTemplate, TemplateToColumnsMatch>(x => x.CurveTemplate);
                template.Curves.Each(curveTemplate => curvesForTemplates.Add(allPossibleCurvesForTemplate(curveTemplate)));

                var bestTemplateForCurves = findBestTemplateForCurves(curvesForTemplates);

                //Ensure that the user wants to continue if the threshold is exceeded
                var numberOfCreatedColumns = bestTemplateForCurves.Sum(x => x.Count);
                if (numberOfCreatedColumns > warningThreshold && warnIfNumberOfCurvesAboveThreshold)
                {
                    var shouldContinue = _dialogCreator.MessageBoxYesNo(Captions.NumberOfSelectedCurveWouldGoOverThreshold(numberOfCreatedColumns));
                    if (shouldContinue == ViewResult.No)
                    {
                        return;
                    }
                }

                //Last but not least, update the chart
                updateChartFromTemplateWithMatchingCurves(chart, template, bestTemplateForCurves, propogateChartChangeEvent);
            }
            finally
            {
                _curveNameDefinition = null;
                _allColumnsByPath.Clear();
            }
        }
Пример #29
0
        public override void InitializeBinding()
        {
            base.InitializeBinding();
            _gridViewBinder.Bind(x => x.Name)
            .AsReadOnly();

            initPathElementColumn(dto => dto.PathElement0, Captions.PathElement(0));
            initPathElementColumn(dto => dto.PathElement1, Captions.PathElement(1));
            initPathElementColumn(dto => dto.PathElement2, Captions.PathElement(2));
            initPathElementColumn(dto => dto.PathElement3, Captions.PathElement(3));
            initPathElementColumn(dto => dto.PathElement4, Captions.PathElement(4));
            initPathElementColumn(dto => dto.PathElement5, Captions.PathElement(5));
            initPathElementColumn(dto => dto.PathElement6, Captions.PathElement(6));
            initPathElementColumn(dto => dto.PathElement7, Captions.PathElement(7));
            initPathElementColumn(dto => dto.PathElement8, Captions.PathElement(8));
            initPathElementColumn(dto => dto.PathElement9, Captions.PathElement(9));

            _gridViewBinder.AutoBind(x => x.ScaleDivisor)
            .WithOnValueUpdating((o, e) => _presenter.UpdateScaleFactorValue(o, e.NewValue));

            _gridViewBinder.Changed += NotifyViewChanged;

            btnCalculateScaleDivisors.Click += (o, e) => OnEvent(async() => await _presenter.StartScaleDivisorsCalculation());
        }
 /// <summary>
 /// Handles the ValueChanged event of the numeric control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void numeric_ValueChanged(object sender, EventArgs e)
 {
     Captions.Invalidate();
     Captions.Update();
 }