public DangerManager(World parent, bool add = true)
     : base(null, new Vector2f(0, 0), parent, add)
 {
     Instance = this;
     new TextEntity("DP: ", new Vector2f(650, 577), parent, Fonts.ExoRegular, 16, Colors.White, Colors.Black);
     _dpDisp = new TextEntity("1/1", new Vector2f(680, 577), parent, Fonts.ExoRegular, 16, Colors.White, Colors.Black);
 }
Example #2
0
        public InfoPanelEntity(Game game, string id, Vector2 position, Vector2 size)
            : base(game, id, position, size, Color.Black)
        {
            CanCollide = false;
            Opacity = 0.75F;

            NextShapeText = new TextEntity(Game, "NextShape", new Vector2(10F, 10F), "Next shape:");

            HighscoreText = new TextEntity(Game, "Highscore", new Vector2(10F, 200F), "?");
            ScoreText = new TextEntity(Game, "Score", new Vector2(10F, HighscoreText.Position.Y + HighscoreText.Size.Y + 10F), "?");
            ScoreToGoText = new TextEntity(Game, "ScoreToGo", new Vector2(10F, ScoreText.Position.Y + ScoreText.Size.Y + 10F), "?");

            BestTimeText = new TextEntity(Game, "BestTime", new Vector2(10F, ScoreToGoText.Position.Y + ScoreToGoText.Size.Y + 50F), "?");
            TimeText = new TextEntity(Game, "Time", new Vector2(10F, BestTimeText.Position.Y + BestTimeText.Size.Y + 10F), "?");
            TimeToGoText = new TextEntity(Game, "TimeToGo", new Vector2(10F, TimeText.Position.Y + TimeText.Size.Y + 10F), "?");

            SpeedText = new TextEntity(Game, "Speed", new Vector2(10F, TimeToGoText.Position.Y + TimeToGoText.Size.Y + 50F), "?");

            AddChild(NextShapeText);

            AddChild(HighscoreText);
            AddChild(ScoreText);
            AddChild(ScoreToGoText);

            AddChild(BestTimeText);
            AddChild(TimeText);
            AddChild(TimeToGoText);

            AddChild(SpeedText);
        }
Example #3
0
        public MenuEntity(Game game, string id, Vector2 position, Vector2 size)
            : base(game, id, position)
        {
            CanCollide = false;

            ResumeButton = new ResumeButtonEntity(Game, "ResumeButton", Vector2.Zero, Game.AssetManager.GetTexture("buttonResume"));
            Minus = new VolumeButtonEntity(Game, "MinusButton", new Vector2(0F, ResumeButton.Position.Y + ResumeButton.Size.Y + 10F), Game.AssetManager.GetTexture("buttonMinus"), -0.1F);
            Volume = new TextureEntity(Game, "Volume", new Vector2(Minus.Position.X + Minus.Size.X + 10F, Minus.Position.Y), Game.AssetManager.GetTexture("buttonVolume"));
            Plus = new VolumeButtonEntity(Game, "PlusButton", new Vector2(Volume.Position.X + Volume.Size.X + 10F, Minus.Position.Y), Game.AssetManager.GetTexture("buttonPlus"), 0.1F);
            Multiplayer = new MultiplayerButtonEntity(Game, "Multiplayer", new Vector2(0F, Minus.Position.Y + Minus.Size.Y + 20F), Game.AssetManager.GetTexture("buttonMultiplayer"));
            ExitButton = new ExitButtonEntity(Game, "ExitButton", new Vector2(0F, Multiplayer.Position.Y + Multiplayer.Size.Y + 20F), Game.AssetManager.GetTexture("buttonExit"));

            VolumePercentage = new TextEntity(Game, "VolumePercentage", Vector2.Zero, "100%");

            ResumeButton.CanCollide = false;
            Minus.CanCollide = false;
            Volume.CanCollide = false;
            Plus.CanCollide = false;
            Multiplayer.CanCollide = false;
            ExitButton.CanCollide = false;
            VolumePercentage.CanCollide = false;

            AddChild(ResumeButton);
            AddChild(Minus);
            AddChild(Volume);
            AddChild(Plus);
            AddChild(Multiplayer);
            AddChild(ExitButton);
            AddChild(VolumePercentage);
        }
        public static TextDetailsViewModel FromEntity(TextEntity textEntity)
        {
            var viewModel = new TextDetailsViewModel
            {
                TextId = textEntity.TextId,
                SimilarityScore = textEntity.SimilarityScore.HasValue ? (textEntity.SimilarityScore.Value * 100) + "%" : "NYA"
            };

            return viewModel;
        }
 public SpawnButton(World parent, Vector2f pos, string tex, int val, bool add = true)
     : base(Rsc.Tex(tex), pos, parent, add)
 {
     _tex = tex;
     Val = val;
     new Entity(Rsc.Tex("rsc/Button.png"), pos, parent);
     {
         Layer = Layer - 1;
     }
     Bounds = new FloatRect(pos.X, pos.Y, 64, 64);
     DPDisp = new TextEntity(val.ToString(CultureInfo.InvariantCulture), pos + new Vector2f(4, 40), parent, Fonts.ExoRegular, 18, Colors.White, Colors.Black)
                  {Layer = Layer - 2};
     Scale /= 2;
 }
    public static Result TextJustify(RhinoDoc doc)
    {
        var text_entity = new TextEntity
        {
          Plane = Plane.WorldXY,
          Text = "Hello Rhino!",
          Justification = TextJustification.MiddleCenter,
          FontIndex = doc.Fonts.FindOrCreate("Arial", false, false)
        };

        doc.Objects.AddText(text_entity);
        doc.Views.Redraw();

        return Result.Success;
    }
        public ActionResult EnterText(TextInputModel model)
        {
            if (string.IsNullOrWhiteSpace(model.Text))
            {
                return this.View();
            }

            var blobName = Guid.NewGuid().ToString();
            var blob = this.blobContainer.GetBlockBlobReference(blobName);
            blob.UploadText(model.Text.Trim());
            var textEntity = new TextEntity(this.User.Identity.GetUserId(), blobName);
            this.textsTable.Execute(TableOperation.InsertOrReplace(textEntity));
            this.queue.AddMessage(new CloudQueueMessage(blobName));

            return this.RedirectToAction("MyTexts");
        }
Example #8
0
        public async Task AddTextAsync(TextEntity text)
        {
            await context.TextEntities.AddAsync(text);

            await context.SaveChangesAsync();
        }
Example #9
0
        public override String Process()
        {
            try
            {
                BeforeProcessing();
            }
            catch (System.Exception se)
            {
                return("Keyfile Generation processing exception: " + se.Message);
            }
            //if (!CheckDirPath()) { return "Invalid path: " + _Path; }

            //try
            //{
            //    _Logger = new Logger(String.Concat(_Path, "\\KeyfileErrors.txt"));
            //}
            //catch (System.Exception se)
            //{
            //    // FATAL ERROR
            //    return "Could not create log file in: " + _Path + " because: " + se.Message;
            //}

            //StartTimer();

            // Get all DWG files
            try
            {
                GetDwgList(SearchOption.TopDirectoryOnly, delegate(String inFile) { return((System.IO.Path.GetFileNameWithoutExtension(inFile).Length < 15)); });
            }
            catch (SystemException se)
            {
                _Logger.Log(" DWG files could not be enumerated because: " + se.Message);
                _Logger.Dispose();
                return(" DWG files could not be enumerated because: " + se.Message);
            }

            if (NumDwgs == 0)
            {
                return("No DWGs found in: " + _Path);
            }

            foreach (String currentDWG in DwgList)
            {
                DwgCounter++;

                try { _Bw.ReportProgress(Utilities.GetPercentage(DwgCounter, NumDwgs)); }
                catch { }

                if (_Bw.CancellationPending)
                {
                    _Logger.Log("Keyfile generation cancelled by user at dwg " + DwgCounter.ToString() + " out of " + DwgList.Count);
                    break;
                }

                String dwgNameNoExt = System.IO.Path.GetFileNameWithoutExtension(currentDWG);
                String dwgNameExt   = System.IO.Path.GetFileName(currentDWG);
                String ms           = String.Empty;

                using (Database db = new Database(false, true))
                {
                    try
                    {
                        db.ReadDwgFile(currentDWG, FileOpenMode.OpenForReadAndWriteNoShare, true, String.Empty);
                        db.Regenmode = true;
                        db.CloseInput(true);
                    }
                    catch (Autodesk.AutoCAD.Runtime.Exception e)
                    {
                        _Logger.Log(String.Concat("Could not read DWG: ", dwgNameNoExt, " because: ", e.Message, "...Continuing to next DWG"));
                        continue;
                    }

                    using (Transaction acTrans = db.TransactionManager.StartTransaction())
                    {
                        // Unlock and thaw all layers
                        ToEach.toEachLayer(db, acTrans, delegate(LayerTableRecord ltr)
                        {
                            if (ltr.IsLocked)
                            {
                                ltr.IsLocked = false;
                            }
                            if (ltr.IsFrozen)
                            {
                                ltr.IsFrozen = false;
                            }
                            return(false);
                        });

                        XmlWriterSettings settings = new XmlWriterSettings();
                        settings.Encoding = Encoding.ASCII;
                        settings.Indent   = true;
                        XmlWriter xmlW = XmlWriter.Create(_Path + "\\" + dwgNameNoExt + "_key.xml", settings);

                        if (xmlW == null)
                        {
                            _Logger.Log("XML writer could not be initialized.");
                            _Logger.Dispose();
                            return("XML file could not be initialized.");
                        }

                        try
                        {
                            xmlW.WriteStartDocument();
                            xmlW.WriteStartElement("rpstl_keyfile");
                            xmlW.WriteAttributeString("version", "2.0");
                            xmlW.WriteStartElement("filename");
                            xmlW.WriteAttributeString("text", dwgNameExt);
                            xmlW.WriteEndElement();

                            // Write dwg extents
                            xmlW.WriteStartElement("extents");
                            xmlW.WriteAttributeString("x1", db.Extmin.X.truncstring(3));
                            xmlW.WriteAttributeString("y1", db.Extmin.Y.truncstring(3));
                            xmlW.WriteAttributeString("x2", db.Extmax.X.truncstring(3));
                            xmlW.WriteAttributeString("y2", db.Extmax.Y.truncstring(3));

                            double height = db.Extmax.Y - db.Extmin.Y;
                            double width  = db.Extmax.X - db.Extmin.X;

                            // Write document height and width
                            xmlW.WriteAttributeString("height", height.truncstring(3));
                            xmlW.WriteAttributeString("width", width.truncstring(3));

                            xmlW.WriteEndElement();

                            // Unlock all layers
                            ToEach.toEachLayer(db, acTrans, delegate(LayerTableRecord ltr)
                            {
                                if (ltr.IsLocked)
                                {
                                    ltr.IsLocked = false;
                                }
                                return(false);
                            }
                                               );

                            db.Regenmode = true;

                            ObjectIdCollection oidc = new ObjectIdCollection();
                            ToEach.toEachEntity(db, acTrans, delegate(Entity ent) { oidc.Add(ent.Id); return(false); });
                            db.Purge(oidc);

                            //Make Dictionary to map layerIds to layer names
                            // Note neccessary because the DBText .Layer property isn't working
                            Dictionary <ObjectId, String> LayerIdToLayerName = new Dictionary <ObjectId, string>();

                            using (LayerTable lt = acTrans.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable)
                            {
                                foreach (ObjectId layerOid in lt)
                                {
                                    using (LayerTableRecord ltr = acTrans.GetObject(layerOid, OpenMode.ForRead) as LayerTableRecord)
                                    {
                                        LayerIdToLayerName.Add(ltr.Id, ltr.Name);
                                    }
                                }
                            }

                            using (LayerTable lt = acTrans.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable)
                            {
                                foreach (ObjectId oid in lt)
                                {
                                    List <DBText>         msNos       = new List <DBText>();
                                    List <DBText>         callouts    = new List <DBText>();
                                    List <DBText>         viewLetters = new List <DBText>();
                                    List <DBText>         miscTexts   = new List <DBText>();
                                    List <BlockReference> cards       = new List <BlockReference>();
                                    //IEnumerable<DBText> msnos = new List<DBText>();
                                    StringBuilder prefixString = new StringBuilder();

                                    using (LayerTableRecord ltr = acTrans.GetObject(oid, OpenMode.ForRead) as LayerTableRecord)
                                    {
                                        List <DBText> linesBelowDesignations = new List <DBText>();

                                        using (BlockTable bt = acTrans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable)
                                        {
                                            using (BlockTableRecord btr = acTrans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead) as BlockTableRecord)
                                            {
                                                foreach (ObjectId oidbtr in btr)
                                                {
                                                    Entity ent = acTrans.GetObject(oidbtr, OpenMode.ForRead) as Entity;

                                                    if (ent.LayerId == ltr.Id)
                                                    {
                                                        if (ent.GetType() == typeof(DBText))
                                                        {
                                                            DBText dbt = ent as DBText;

                                                            String layerName = LayerIdToLayerName[dbt.LayerId];
                                                            // Skip everything on "FILENAME" and "SCALE" layers
                                                            if (String.Equals(layerName, "FILENAME") || String.Equals(layerName, "SCALE"))
                                                            {
                                                                continue;
                                                            }

                                                            if (dbt.TextString.Trim().ToUpper().EndsWith("(REF)"))
                                                            {
                                                                // Skip old refdess
                                                                continue;
                                                            }

                                                            // P/0 instead of P/O
                                                            if (String.Equals(dbt.TextString.Trim(), "P/0"))
                                                            {
                                                                _Logger.Log("P/0 found instead of P/O on layer: " + dbt.Layer + " in DWG: " + dwgNameNoExt);
                                                            }

                                                            if (calloutRegex.IsMatch(dbt.TextString) && !dbt.TextString.Contains("-") && layerName.StartsWith("m"))
                                                            {
                                                                callouts.Add(dbt);
                                                                continue;
                                                            }

                                                            // Skip view letters that are on layers that aren't m layers
                                                            if (viewLetterRegex.IsMatch(dbt.TextString.Trim()) && layerName.StartsWith("m"))
                                                            {
                                                                viewLetters.Add(dbt);
                                                                continue;
                                                            }

                                                            // Skip msnos that are on layers that aren't m layers
                                                            if ((msRegex.IsMatch(dbt.TextString.ToUpper()) || letterRegex.IsMatch(dbt.TextString.ToUpper())) && layerName.StartsWith("m"))
                                                            {
                                                                msNos.Add(dbt);
                                                                continue;
                                                            }

                                                            if (refDesRegex.IsMatch(dbt.TextString.ToUpper().Trim())) //&&
                                                            {
                                                                // Do nothing
                                                                // Look for refdess on a per-callout basis because refdes
                                                                // must be within a certain range of each callout
                                                                continue;
                                                            }

                                                            // Check if text refdes
                                                            if (dbt.TextString.Contains("DESIGNATIONS"))
                                                            {
                                                                // Get prefix from line with Designations
                                                                prefixString.Append(dbt.TextString.Substring(dbt.TextString.IndexOf("WITH") + 5).Trim());

                                                                // Get each line below Designations line and add it to list
                                                                linesBelowDesignations = ToEach.toEachDBText(db,
                                                                                                             acTrans,
                                                                                                             delegate(DBText dbtUnderDes)
                                                                {
                                                                    double yDiff = dbt.Position.Y - dbtUnderDes.Position.Y;
                                                                    double xDiff = Math.Abs(dbt.Position.X - dbtUnderDes.Position.X);

                                                                    return((dbt.Id != dbtUnderDes.Id) &&
                                                                           (dbt.LayerId == dbtUnderDes.LayerId) &&
                                                                           (dbt.Position.Y > dbtUnderDes.Position.Y) &&
                                                                           (yDiff < .5) &&
                                                                           (xDiff < .02));
                                                                });

                                                                // Append each line to String and format it with spaces and commas
                                                                foreach (DBText lineBelowDes in linesBelowDesignations)
                                                                {
                                                                    if (prefixString[prefixString.Length - 1] != ',')
                                                                    {
                                                                        prefixString.Append(String.Concat(", ", lineBelowDes.TextString.Trim()));
                                                                        continue;
                                                                    }
                                                                    if (prefixString[prefixString.Length - 1] == ',')
                                                                    {
                                                                        prefixString.Append(String.Concat(" ", lineBelowDes.TextString.Trim()));
                                                                        continue;
                                                                    }
                                                                }

                                                                // Delete trailing comma if it exists
                                                                if (prefixString[prefixString.Length - 1] == ',')
                                                                {
                                                                    prefixString.Length--;
                                                                }
                                                                // TODO ?
                                                                continue;
                                                            }

                                                            miscTexts.Add(dbt);
                                                        }

                                                        if (ent.GetType() == typeof(BlockReference))
                                                        {
                                                            BlockReference br = acTrans.GetObject(oidbtr, OpenMode.ForRead) as BlockReference;

                                                            if (br.Name.Contains("PRENOTE"))
                                                            {
                                                                _Logger.Log("DWG: " + dwgNameExt + ": layer: " + LayerIdToLayerName[br.LayerId] + ": " + "block reference prefix note found");
                                                            }
                                                            if (br.Name.Contains("HCRDTBL"))
                                                            {
                                                                cards.Add(br);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        xmlW.WriteStartElement("layer");
                                        xmlW.WriteAttributeString("text", ltr.Name);

                                        if (prefixString.Length > 0)
                                        {
                                            xmlW.WriteAttributeString("refdes_prefix", prefixString.ToString());
                                        }

                                        foreach (BlockReference br in cards)
                                        {
                                            Autodesk.AutoCAD.DatabaseServices.AttributeCollection attCol = br.AttributeCollection;

                                            AttributeReference attRefRefDes = acTrans.GetObject(br.AttributeCollection[0], OpenMode.ForRead) as AttributeReference;
                                            AttributeReference attRefItem   = acTrans.GetObject(br.AttributeCollection[1], OpenMode.ForRead) as AttributeReference;

                                            xmlW.WriteStartElement("callout");
                                            xmlW.WriteAttributeString("text", (String.IsNullOrWhiteSpace(attRefItem.TextString)) ? "no_itemno_for_card_slot" : attRefItem.TextString);
                                            xmlW.writeOutAttRefMinMax(attRefItem);

                                            xmlW.WriteStartElement("refdes");
                                            xmlW.WriteAttributeString("text", attRefRefDes.TextString);
                                            xmlW.writeOutAttRefMinMax(attRefRefDes);
                                            xmlW.WriteEndElement();

                                            xmlW.WriteEndElement();
                                        }
                                        foreach (DBText viewLetter in viewLetters)
                                        {
                                            TextEntity tent = new TextEntity(viewLetter);
                                            xmlW.WriteStartElement("view_letter");
                                            xmlW.WriteAttributeString("text", tent.text);
                                            xmlW.writeOutMinMax(tent, _Logger);
                                            xmlW.WriteEndElement();
                                        }

                                        foreach (DBText msNo in msNos)
                                        {
                                            TextEntity tent = new TextEntity(msNo);
                                            xmlW.WriteStartElement("msno");
                                            xmlW.WriteAttributeString("text", tent.text);
                                            xmlW.writeOutMinMax(tent, _Logger);
                                            xmlW.WriteEndElement();
                                        }

                                        foreach (DBText callout in callouts)
                                        {
                                            TextEntity tent = new TextEntity(callout);
                                            xmlW.WriteStartElement("callout");
                                            xmlW.writeOutMinMax(tent, _Logger);
                                            List <DBText> refDess = new List <DBText>();
                                            refDess = ToEach.toEachDBText(db,
                                                                          acTrans,
                                                                          delegate(DBText possibleRefDes)
                                            {
                                                const System.Double yRange = .15;
                                                const System.Double xRange = .15;

                                                return(possibleRefDes.Id != callout.Id &&
                                                       possibleRefDes.LayerId == callout.LayerId &&
                                                       refDesRegex.IsMatch(possibleRefDes.TextString.ToUpper().Trim()) &&
                                                       //!possibleRefDes.TextString.Contains(",") &&
                                                       //!possibleRefDes.TextString.Contains("-") &&
                                                       (possibleRefDes.IsAbove(callout, .1135 /*.5*/) ||
                                                        possibleRefDes.IsInRect(callout.AlignmentPoint.X - xRange,
                                                                                callout.AlignmentPoint.Y,
                                                                                callout.AlignmentPoint.X,
                                                                                callout.AlignmentPoint.Y + yRange) ||
                                                        possibleRefDes.IsInRect(callout.AlignmentPoint.X,
                                                                                callout.AlignmentPoint.Y,
                                                                                callout.AlignmentPoint.X + xRange,
                                                                                callout.AlignmentPoint.Y + yRange)) &&
                                                       !callout.IsRefDesBetween(possibleRefDes, acTrans, db)
                                                       );
                                            });
                                            if (refDess.Count > 1)
                                            {
                                                if (callout.Justify != AttachmentPoint.MiddleCenter)
                                                {
                                                    _Logger.Log("DWG: " +
                                                                dwgNameExt +
                                                                " layer: " +
                                                                LayerIdToLayerName[tent.dbText.LayerId] +
                                                                " callout: " +
                                                                tent.text +
                                                                " has an alignment point that isn't middle center" +
                                                                " (" +
                                                                tent.dbText.Position.X.truncstring(3) +
                                                                ", " +
                                                                tent.dbText.Position.Y.truncstring(3) +
                                                                ") ");
                                                }
                                                else
                                                {
                                                    _Logger.Log("DWG: " +
                                                                dwgNameExt +
                                                                " layer: " +
                                                                LayerIdToLayerName[tent.dbText.LayerId] +
                                                                " has more than one refdes for callout: " +
                                                                tent.text +
                                                                " (" +
                                                                tent.dbText.Position.X.truncstring(3) +
                                                                ", " +
                                                                tent.dbText.Position.Y.truncstring(3) +
                                                                ") "); //tent.dbText.Layer);
                                                }
                                            }

                                            xmlW.WriteAttributeString("text", tent.text);

                                            foreach (DBText refdes in refDess)
                                            {
                                                TextEntity tentRefDes = new TextEntity(refdes);
                                                xmlW.WriteStartElement("refdes");
                                                xmlW.WriteAttributeString("text", tentRefDes.text);
                                                xmlW.writeOutMinMax(tentRefDes, _Logger);
                                                xmlW.WriteEndElement();
                                            }
                                            xmlW.WriteEndElement();
                                        }
                                        foreach (DBText otherText in miscTexts)
                                        {
                                            if (!linesBelowDesignations.Contains(otherText))
                                            {
                                                TextEntity tent = new TextEntity(otherText);
                                                xmlW.WriteStartElement("other_text");
                                                xmlW.WriteAttributeString("text", tent.text);
                                                xmlW.writeOutMinMax(tent, _Logger);
                                                xmlW.WriteEndElement();
                                            }
                                        }
                                        xmlW.WriteEndElement();
                                    }
                                }
                            }
                        }
                        catch (System.Exception se)
                        {
                            _Logger.Log("DWG: " + dwgNameExt + ": processing error of type: " + se.GetType().ToString() + " : " + se.Message);
                        }
                        finally
                        {
                            xmlW.WriteEndElement();
                            xmlW.WriteRaw(Environment.NewLine);
                            xmlW.WriteEndDocument();
                            xmlW.Flush();
                            xmlW.Close();
                        }
                        acTrans.Commit();
                    }
                }
            }

            AfterProcessing();

            return(String.Concat(DwgCounter.ToString(),
                                 " out of ",
                                 NumDwgs,
                                 " DWGs processed in ",
                                 TimePassed,
                                 ". ",
                                 (_Logger.ErrorCount > 0) ? ("Error Log: " + _Logger.Path) : ("No errors found.")));
        }
Example #10
0
        protected override Result RunCommand(Rhino.RhinoDoc doc, RunMode mode)
        {
            // TODO: start here modifying the behaviour of your command.
            // ---

            /*
             * RhinoApp.WriteLine("The {0} command will add a line right now.", EnglishName);
             *
             * Point3d pt0;
             * using (GetPoint getPointAction = new GetPoint())
             * {
             *  getPointAction.SetCommandPrompt("Please select the start point");
             *  if (getPointAction.Get() != GetResult.Point)
             *  {
             *      RhinoApp.WriteLine("No start point was selected.");
             *      return getPointAction.CommandResult();
             *  }
             *  pt0 = getPointAction.Point();
             * }
             *
             * Point3d pt1;
             * using (GetPoint getPointAction = new GetPoint())
             * {
             *  getPointAction.SetCommandPrompt("Please select the end point");
             *  getPointAction.SetBasePoint(pt0, true);
             *  getPointAction.DrawLineFromPoint(pt0, true);
             *  if (getPointAction.Get() != GetResult.Point)
             *  {
             *      RhinoApp.WriteLine("No end point was selected.");
             *      return getPointAction.CommandResult();
             *  }
             *  pt1 = getPointAction.Point();
             * }
             *
             * doc.Objects.AddLine(pt0, pt1);
             * doc.Views.Redraw();
             * RhinoApp.WriteLine("The {0} command added one line to the document.", EnglishName);
             */

            var font_index = doc.Fonts.FindOrCreate("Times New Roman", true, false);

            var text_entity = new TextEntity
            {
                FontIndex     = font_index,
                Justification = TextJustification.None,
                Plane         = Plane.WorldXY,
                Text          = "Hell Yes!",
                TextHeight    = 5.0
            };

            var curves = text_entity.Explode();

            var dir = new Vector3d(0, 0, 5);

            foreach (var curve in curves)
            {
                var surface = Surface.CreateExtrusion(curve, dir);
                doc.Objects.AddSurface(surface);
            }

            doc.Views.Redraw();

            return(Result.Success);
        }
Example #11
0
 public bool Replace(Guid guid, TextEntity text)
 {
     throw NotSupportedExceptionHelp();
 }
Example #12
0
 public VolumnControl()
 {
     title    = new TextEntity();
     progress = new BasicEntity();
     control  = new BasicEntity();
 }
Example #13
0
        private async Task RecognizeEntitiesAsync(DialogContext dialogContext, Schema.Activity activity, RecognizerResult recognizerResult)
        {
            var text       = activity.Text ?? string.Empty;
            var entityPool = new List <Entity>();

            if (EntityRecognizers != null)
            {
                // add entities from regexrecgonizer to the entities pool
                var textEntity = new TextEntity(text);
                textEntity.Properties["start"] = 0;
                textEntity.Properties["end"]   = text.Length;
                textEntity.Properties["score"] = 1.0;

                entityPool.Add(textEntity);

                // process entities using EntityRecognizerSet
                var entitySet   = new EntityRecognizerSet(EntityRecognizers);
                var newEntities = await entitySet.RecognizeEntitiesAsync(dialogContext, activity, entityPool).ConfigureAwait(false);

                if (newEntities.Any())
                {
                    entityPool.AddRange(newEntities);
                }

                entityPool.Remove(textEntity);
            }

            // map entityPool of Entity objects => RecognizerResult entity format
            recognizerResult.Entities = new JObject();

            foreach (var entityResult in entityPool)
            {
                // add value
                JToken values;
                if (!recognizerResult.Entities.TryGetValue(entityResult.Type, StringComparison.OrdinalIgnoreCase, out values))
                {
                    values = new JArray();
                    recognizerResult.Entities[entityResult.Type] = values;
                }

                // The Entity type names are not consistent, map everything to camelcase so we can process them cleaner.
                var entity = JObject.FromObject(entityResult);
                ((JArray)values).Add(entity.GetValue("text", StringComparison.InvariantCulture));

                // get/create $instance
                if (!recognizerResult.Entities.TryGetValue("$instance", StringComparison.OrdinalIgnoreCase, out JToken instanceRoot))
                {
                    instanceRoot = new JObject();
                    recognizerResult.Entities["$instance"] = instanceRoot;
                }

                // add instanceData
                if (!((JObject)instanceRoot).TryGetValue(entityResult.Type, StringComparison.OrdinalIgnoreCase, out JToken instanceData))
                {
                    instanceData = new JArray();
                    instanceRoot[entityResult.Type] = instanceData;
                }

                var instance = new JObject();
                instance.Add("startIndex", entity.GetValue("start", StringComparison.InvariantCulture));
                instance.Add("endIndex", entity.GetValue("end", StringComparison.InvariantCulture));
                instance.Add("score", (double)1.0);
                instance.Add("text", entity.GetValue("text", StringComparison.InvariantCulture));
                instance.Add("type", entity.GetValue("type", StringComparison.InvariantCulture));
                instance.Add("resolution", entity.GetValue("resolution", StringComparison.InvariantCulture));
                ((JArray)instanceData).Add(instance);
            }
        }
Example #14
0
        public void TextEntity_ValuePropertyAppearsInOutput()
        {
            var e = new TextEntity("planet");

            Assert.IsTrue(e.Next() == "planet");
        }
Example #15
0
        /// <summary>
        /// Inicializuje kreslení
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void drawingStart(object sender, MouseButtonEventArgs e)
        {
            Point mousePosition = e.GetPosition(this.canvas);

            this.selection.UnselectAll();
            this.selection.State = SelectionState.Draw;
            this.selection.InitTransformation(e.GetPosition(this.canvas));

            switch (this.mode)
            {
            case DrawMode.Bitmap:
                BitmapEntity bitmap = new BitmapEntity();
                System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog();
                dialog.Filter = "Soubory obrázků|*.jpg;*.jpeg;*.gif;*.png;*.tif;*.tiff;*.bmp|Všechny soubory|*.*";
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    bitmap.LoadFromFile(dialog.FileName);
                    this.document.AddEntity(bitmap);
                    this.drawNewEntity(bitmap, mousePosition);
                    this.drawingStop(sender, e);
                }
                break;

            case DrawMode.Text:
                TextEntity text = new TextEntity();
                TextInput  dlg  = new TextInput();
                if (dlg.ShowDialog().Value)
                {
                    text.Text = dlg.Text;
                    if (!String.IsNullOrEmpty(text.Text))
                    {
                        this.document.AddEntity(text);
                        this.drawNewEntity(text, mousePosition);
                        this.drawingStop(sender, e);
                    }
                }
                break;

            case DrawMode.Line:
                this.drawNewEntity(this.document.AddNewEntity <LineEntity>(), mousePosition);
                this.MouseLeftButtonUp = drawingStop;
                this.MouseMove         = drawingProcess;
                break;

            case DrawMode.Rectangle:
                this.drawNewEntity(this.document.AddNewEntity <RectangleEntity>(), mousePosition);
                this.MouseLeftButtonUp = drawingStop;
                this.MouseMove         = drawingProcess;
                break;

            case DrawMode.Ellipse:
                this.drawNewEntity(this.document.AddNewEntity <EllipseEntity>(), mousePosition);
                this.MouseLeftButtonUp = drawingStop;
                this.MouseMove         = drawingProcess;
                break;

            case DrawMode.Dimension:
                this.drawNewEntity(this.document.AddNewEntity <DimensionEntity>(), mousePosition);
                this.MouseLeftButtonUp = drawingStop;
                this.MouseMove         = drawingProcess;
                break;

            case DrawMode.Polygon:
                if (this.polygonPoints.Count == 0)
                {
                    this.MouseMove = delegate(object _sender, System.Windows.Input.MouseEventArgs _e) { this.selection.Transform(e.GetPosition(this.canvas)); }
                }
                ;
                else
                {
                    mousePosition = this.selection.CorrectedMousePosition;
                    if (this.polygonPoints.Count > 2 && mousePosition == this.polygonPoints[this.polygonPoints.Count - 1])
                    {
                        this.drawPolygonEntity(this.polygonPoints);
                        this.drawingStop(sender, e);
                        break;
                    }
                }

                Entity line = new LineEntity();
                line.Move(mousePosition);
                this.polygonPoints.Add(mousePosition);
                this.canvas.Children.Add(line.Shape);
                this.selection.SelectWithoutBorder(line);
                break;
            }
        }
Example #16
0
        protected override async void OnPaste(HandledEventArgs e)
        {
            try
            {
                // If the user tries to paste RTF content from any TOM control (Visual Studio, Word, Wordpad, browsers)
                // we have to handle the pasting operation manually to allow plaintext only.
                var package = Clipboard.GetContent();
                if (package.AvailableFormats.Contains(StandardDataFormats.Bitmap) || package.AvailableFormats.Contains(StandardDataFormats.StorageItems))
                {
                    e.Handled = true;
                    await ViewModel.HandlePackageAsync(package);
                }
                else if (package.AvailableFormats.Contains(StandardDataFormats.Text) && package.AvailableFormats.Contains("application/x-tl-field-tags"))
                {
                    e.Handled = true;

                    // This is our field format
                    var text = await package.GetTextAsync();

                    var data = await package.GetDataAsync("application/x-tl-field-tags") as IRandomAccessStream;

                    var reader = new DataReader(data.GetInputStreamAt(0));
                    var length = await reader.LoadAsync((uint)data.Size);

                    var count    = reader.ReadInt32();
                    var entities = new List <TextEntity>(count);

                    for (int i = 0; i < count; i++)
                    {
                        var entity = new TextEntity {
                            Offset = reader.ReadInt32(), Length = reader.ReadInt32()
                        };
                        var type = reader.ReadByte();

                        switch (type)
                        {
                        case 1:
                            entity.Type = new TextEntityTypeBold();
                            break;

                        case 2:
                            entity.Type = new TextEntityTypeItalic();
                            break;

                        case 3:
                            entity.Type = new TextEntityTypePreCode();
                            break;

                        case 4:
                            entity.Type = new TextEntityTypeTextUrl {
                                Url = reader.ReadString(reader.ReadUInt32())
                            };
                            break;

                        case 5:
                            entity.Type = new TextEntityTypeMentionName {
                                UserId = reader.ReadInt32()
                            };
                            break;
                        }

                        entities.Add(entity);
                    }

                    InsertText(text, entities);
                }
                else if (package.AvailableFormats.Contains(StandardDataFormats.Text) /*&& package.Contains("Rich Text Format")*/)
                {
                    e.Handled = true;

                    var text = await package.GetTextAsync();

                    var start = Document.Selection.StartPosition;

                    Document.Selection.SetText(TextSetOptions.None, text);
                    Document.Selection.SetRange(start + text.Length, start + text.Length);
                }
            }
            catch { }
        }
Example #17
0
        /// <summary>
        /// 打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PrintDocument_PrintPage(object sender, PrintPageEventArgs e)
        {
            this.bru = Brushes.Black;
            this.g   = e.Graphics;

            foreach (RowEntity row in this.Page.Rows.Where(item => item.RowType == (int)ERowType.Table))
            {
                TableEntity RowItem = row as TableEntity;
                float       TabLeft = RowItem.Left;

                Action <List <TdEntity> > action = (List <TdEntity> listTD) =>
                {
                    float CurrentLeft = TabLeft;
                    foreach (TdEntity Td in listTD)
                    {
                        if (!Td.ListContent.IsNullOrEmpty())
                        {
                            foreach (ContentEntity item in Td.ListContent)
                            {
                                if (item is StrLineEntity)
                                {
                                }
                                else if (item is TextEntity)
                                {
                                    TextEntity Content = item as TextEntity;
                                    Content.Left = Content.Left + CurrentLeft;
                                }
                                else if (item is ImageEntity)
                                {
                                    ImageEntity Content = item as ImageEntity;
                                    Content.Left = Content.Left + CurrentLeft;
                                }
                                else if (item is QRCodeEntity)
                                {
                                    QRCodeEntity Content = item as QRCodeEntity;
                                    Content.Left = Content.Left + CurrentLeft;
                                }
                                else if (item is BarCodeEntity)
                                {
                                    BarCodeEntity Content = item as BarCodeEntity;
                                    Content.Left = Content.Left + CurrentLeft;
                                }
                            }
                        }
                        CurrentLeft = CurrentLeft + Td.Width;
                    }
                };
                if (RowItem.Head != null)
                {
                    action(RowItem.Head.ListTD);
                }
                if (!RowItem.ListTR.IsNullOrEmpty())
                {
                    foreach (TrEntity td in RowItem.ListTR)
                    {
                        action(td.ListTD);
                    }
                }
            }

            foreach (RowEntity row in this.Page.Rows)
            {
                if (row.RowType == (int)ERowType.Line)
                {
                    LineEntity RowItem = row as LineEntity;
                    this.WriteLine(RowItem, this.DataSource);
                }
                else if (row.RowType == (int)ERowType.Loop)
                {
                    LoopEntity RowItem = row as LoopEntity;
                    string     KeyName = RowItem.KeyName;
                    object     ds      = this.DataSource.Value <string, object>(KeyName);
                    List <Dictionary <string, object> > listSource = ds as List <Dictionary <string, object> >;
                    if (!listSource.IsNullOrEmpty())
                    {
                        this.WriteLoop(RowItem, listSource);
                    }
                }
                else if (row.RowType == (int)ERowType.Table)
                {
                    TableEntity RowItem = row as TableEntity;
                    string      KeyName = RowItem.KeyName;
                    object      ds      = this.DataSource.Value <string, object>(KeyName);
                    List <Dictionary <string, object> > listSource = ds as List <Dictionary <string, object> >;
                    if (!listSource.IsNullOrEmpty())
                    {
                        this.WriteTable(RowItem, listSource);
                    }
                }
            }
        }
Example #18
0
        private Mesh GenerateJointArmLabel(Point3d origin, Vector3d direction, string label, double length)
        {
            Polyline innerPoly;
            var      innerProfile = GetProfile(InnerWallRadius, direction);

            innerProfile.TryGetPolyline(out innerPoly);

            var pSideMid = (innerPoly[1] + innerPoly[0]) / 2 + origin;

            Vector3d dir1 = length < 0 ? direction : -direction;
            Vector3d dir3 = pSideMid - origin;
            Vector3d dir2 = Vector3d.CrossProduct(dir3, dir1);

            dir1.Unitize();
            dir2.Unitize();
            dir3.Unitize();

            var textHeight   = Math.Sqrt(OuterWallRadius * OuterWallRadius - InnerWallRadius * InnerWallRadius) / 1.5;
            var embossHeight = (OuterWallRadius - InnerWallRadius) * 1.2;

            Vector3d startTextOffset = (length < 0 ? -direction : direction) * (Math.Abs(length) - (OuterWallRadius - InnerWallRadius));

            Point3d planeOrigin = Point3d.Add(origin, startTextOffset);

            planeOrigin = Point3d.Add(planeOrigin, dir3 * (pSideMid - origin).Length);

            JointArmLabel[label] = planeOrigin;

            var plane = new Plane(planeOrigin, dir1, dir2);

            plane.UpdateEquation();

            var style = new Rhino.DocObjects.DimensionStyle();

            style.TextHorizontalAlignment = Rhino.DocObjects.TextHorizontalAlignment.Left;
            style.TextVerticalAlignment   = Rhino.DocObjects.TextVerticalAlignment.Middle;
            style.TextHeight = 1;
            var prefFont = Rhino.DocObjects.Font.InstalledFonts("Lucida Console");

            if (prefFont.Length > 0)
            {
                style.Font = prefFont.First();
            }

            var writingPlane = new Plane(planeOrigin, new Vector3d(0, 0, 1)); // Must write to flat plane for some reason

            TextEntity textEnt = TextEntity.Create(label, writingPlane, style, false, Math.Abs(length), 0);

            textEnt.SetBold(true);

            var meshes = textEnt.CreateExtrusions(style, embossHeight)
                         .Where(b => b != null)
                         .SelectMany(b => Mesh.CreateFromBrep(b.ToBrep(), MeshingParameters.FastRenderMesh));

            var scaleTrans = Transform.Scale(writingPlane, textHeight, textHeight, 1);
            var trans      = Transform.PlaneToPlane(writingPlane, plane);

            if (meshes.Count() > 0)
            {
                var mesh = meshes.First();
                foreach (var m in meshes.Skip(1))
                {
                    mesh.Append(m);
                }
                mesh.Weld(Tolerance);
                mesh.Normals.ComputeNormals();
                mesh.UnifyNormals();
                mesh.Normals.ComputeNormals();
                mesh.Transform(scaleTrans);
                mesh.Transform(trans);
                return(mesh);
            }

            return(null);
        }
Example #19
0
 private void Replace(TextStyleRun run)
 {
     Flags  = run.Flags;
     Entity = run.Entity;
 }
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            string face    = "";
            bool   bold    = false;
            bool   italics = false;
            double size    = 0;
            string content = "";
            Plane  pl      = Plane.Unset;

            if (!DA.GetData("Face", ref face))
            {
                return;
            }
            if (!DA.GetData("Bold", ref bold))
            {
                return;
            }
            if (!DA.GetData("Italics", ref italics))
            {
                return;
            }
            if (!DA.GetData("Size", ref size))
            {
                return;
            }
            if (!DA.GetData("Text Content", ref content))
            {
                return;
            }
            if (!DA.GetData("Plane", ref pl))
            {
                return;
            }

            if (size == 0)
            {
                size = 1;
            }

            if (!string.IsNullOrEmpty(face) && size > 0 && !string.IsNullOrEmpty(content) &&
                pl.IsValid)
            {
                if (!Rhino.DocObjects.Font.AvailableFontFaceNames().Contains(face))
                {
                    AddRuntimeMessage(GH_RuntimeMessageLevel.Error, ("That face is not available"));
                }
                Rhino.DocObjects.Font.FontWeight weight = Rhino.DocObjects.Font.FontWeight.Normal;
                Rhino.DocObjects.Font.FontStyle  style  = Rhino.DocObjects.Font.FontStyle.Upright;

                if (bold)
                {
                    weight = Rhino.DocObjects.Font.FontWeight.Bold;
                }

                if (italics)
                {
                    style = Rhino.DocObjects.Font.FontStyle.Italic;
                }

                var te = new TextEntity()
                {
                    Plane      = pl,
                    PlainText  = content,
                    TextHeight = size,
                    Font       = new Rhino.DocObjects.Font(face, weight, style, false, false)
                };
                var crvs = te.Explode();
                DA.SetDataList("Text Curves", crvs);
                var bbox = BoundingBox.Empty;
                foreach (var curve in crvs)
                {
                    bbox.Union(curve.GetBoundingBox(true));
                }
                DA.SetData("Text Bounding Box", bbox);
            }
        }
Example #21
0
 public void TextEntity(TextEntity te)
 {
     writer.Write(te.Content);
 }
        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            // Do some error checking first
            // If Path == nothing, ask user to save first.
            if (doc.Path == "")
            {
                System.Windows.Forms.MessageBox.Show("Please save Rhino file before you can export.", "Export Error");
                return(Result.Failure);
            }

            // Get all selected Objects
            GetObject go = new GetObject();

            go.GroupSelect     = true;
            go.SubObjectSelect = false;
            go.EnableClearObjectsOnEntry(false);
            go.EnableUnselectObjectsOnExit(false);
            go.DeselectAllBeforePostSelect = false;
            go.EnableSelPrevious(true);
            go.EnablePreSelect(true, false);
            go.EnablePressEnterWhenDonePrompt(false);

            go.SetCommandPrompt("Select objects and a label to export as .DXF:");

            GetResult result = go.GetMultiple(1, -1);

            if (go.CommandResult() != Rhino.Commands.Result.Success)
            {
                return(go.CommandResult());
            }

            RhinoApp.WriteLine("Total Objects Selected: {0}", go.ObjectCount);

            string labelName = null;

            if (doc.Path == null)
            {
                System.Windows.Forms.MessageBox.Show("Please save the file as .3dm file first");
                return(Result.Failure);
            }

            if (Path.GetFileName(doc.Path).Split('.').Length == 1)
            {
                System.Windows.Forms.MessageBox.Show("Please save the file as .3dm file first");
                return(Result.Failure);
            }

            if (Path.GetFileName(doc.Path).Split('.').Length == 2 && !(Path.GetFileName(doc.Path).Split('.')[1].Equals("3dm")))
            {
                System.Windows.Forms.MessageBox.Show("Please save the file as .3dm file first");
                return(Result.Failure);
            }
            // Loop through all the objects to find Text
            for (int i = 0; i < go.ObjectCount; i++)
            {
                RhinoObject rhinoObject = go.Object(i).Object();

                if (rhinoObject.ObjectType == ObjectType.Annotation)
                {
                    TextEntity textEntity = rhinoObject.Geometry as TextEntity;

                    if (textEntity != null)
                    {
                        labelName = CleanString(textEntity.Text.Trim()) + ".dxf";
                    }
                }
            }

            if (labelName == null)
            {
                return(Rhino.Commands.Result.Failure);
            }


            String path = Path.GetDirectoryName(doc.Path);

            // Export the whole lot
            //string command = string.Format("-_Export \"" + Path.GetDirectoryName(doc.Path) + @"\" + labelName + "\"  Scheme \"R12 Lines & Arcs\" Enter");
            string command = string.Format("-_Export \"" + Path.GetDirectoryName(doc.Path) + @"\" + labelName + "\" Enter");

            // Export the selected curves
            RhinoApp.RunScript(command, true);

            return(Result.Success);
        }
        public async Task RunAsync(PerformContext context, IJobCancellationToken cancellationToken, string userId,
                                   string jobId)
        {
            _job = await _jobs.UpdateAsync(j => j.Id == jobId, u => u
                                           .Set(j => j.BackgroundJobId, context.BackgroundJob.Id)
                                           .Set(j => j.State, SyncJobEntity.SyncingState));

            if (_job == null)
            {
                return;
            }

            try
            {
                if ((await _users.TryGetAsync(userId)).TryResult(out UserEntity user) &&
                    (await _projects.TryGetAsync(_job.ProjectRef)).TryResult(out SFProjectEntity project))
                {
                    if (!_fileSystemService.DirectoryExists(WorkingDir))
                    {
                        _fileSystemService.CreateDirectory(WorkingDir);
                    }

                    bool translateEnabled = project.TranslateConfig.Enabled;
                    using (IConnection conn = await _realtimeService.ConnectAsync())
                    {
                        string targetParatextId            = project.ParatextId;
                        IReadOnlyList <string> targetBooks = await _paratextService.GetBooksAsync(user,
                                                                                                  targetParatextId);

                        string sourceParatextId            = project.TranslateConfig.SourceParatextId;
                        IReadOnlyList <string> sourceBooks = null;
                        if (translateEnabled)
                        {
                            sourceBooks = await _paratextService.GetBooksAsync(user, sourceParatextId);
                        }

                        var booksToSync = new HashSet <string>(targetBooks);
                        if (translateEnabled)
                        {
                            booksToSync.IntersectWith(sourceBooks);
                        }

                        var booksToDelete = new HashSet <string>(
                            GetBooksToDelete(project, targetParatextId, targetBooks));
                        if (translateEnabled)
                        {
                            booksToDelete.UnionWith(GetBooksToDelete(project, sourceParatextId, sourceBooks));
                        }

                        _step      = 0;
                        _stepCount = booksToSync.Count * 3;
                        if (translateEnabled)
                        {
                            _stepCount *= 2;
                        }
                        _stepCount += booksToDelete.Count;
                        foreach (string bookId in booksToSync)
                        {
                            if (!BookNames.TryGetValue(bookId, out string name))
                            {
                                name = bookId;
                            }
                            TextEntity text = await _texts.UpdateAsync(
                                t => t.ProjectRef == project.Id && t.BookId == bookId,
                                u => u
                                .SetOnInsert(t => t.Name, name)
                                .SetOnInsert(t => t.BookId, bookId)
                                .SetOnInsert(t => t.ProjectRef, project.Id)
                                .SetOnInsert(t => t.OwnerRef, userId), upsert : true);

                            List <Chapter> newChapters = await SyncOrCloneBookUsxAsync(user, conn, project, text,
                                                                                       TextType.Target, targetParatextId, false);

                            if (translateEnabled)
                            {
                                var chaptersToInclude = new HashSet <int>(newChapters.Select(c => c.Number));
                                await SyncOrCloneBookUsxAsync(user, conn, project, text, TextType.Source,
                                                              sourceParatextId, true, chaptersToInclude);
                            }
                            await UpdateNotesData(conn, text, newChapters);
                        }

                        foreach (string bookId in booksToDelete)
                        {
                            TextEntity text = await _texts.DeleteAsync(
                                t => t.ProjectRef == project.Id && t.BookId == bookId);

                            await DeleteBookUsxAsync(conn, project, text, TextType.Target, targetParatextId);

                            if (translateEnabled)
                            {
                                await DeleteBookUsxAsync(conn, project, text, TextType.Source, sourceParatextId);
                            }
                            await DeleteNotesData(conn, text);
                            await UpdateProgress();
                        }
                    }

                    // TODO: Properly handle job cancellation
                    cancellationToken.ThrowIfCancellationRequested();

                    if (translateEnabled)
                    {
                        // start training Machine engine
                        await _engineService.StartBuildByProjectIdAsync(_job.ProjectRef);
                    }

                    await _projects.UpdateAsync(_job.ProjectRef, u => u
                                                .Set(p => p.LastSyncedDate, DateTime.UtcNow)
                                                .Unset(p => p.ActiveSyncJobRef));
                }
                else
                {
                    await _projects.UpdateAsync(_job.ProjectRef, u => u.Unset(p => p.ActiveSyncJobRef));
                }
                _job = await _jobs.UpdateAsync(_job, u => u
                                               .Set(j => j.State, SyncJobEntity.IdleState)
                                               .Unset(j => j.BackgroundJobId));
            }
Example #24
0
 public Loading()
 {
     background   = new BasicEntity();
     loadingTitle = new TextEntity();
     worker       = new BackgroundWorker();
 }
Example #25
0
 public void TextEntity(TextEntity te)
 {
     Write("entity {0}", format_str(te.Content));
 }
Example #26
0
        public void TextEntity_NoValueGeneratesBlankString()
        {
            var e = new TextEntity();

            Assert.IsTrue(e.Next() == string.Empty);
        }