Example #1
0
        private void ButtonClick(object sender, RoutedEventArgs e)
        {
            Log.Info("After confirming the name of the new layer");
            var newLayerName = _addNewLayerTextBox.Text;

            if (_container.LayerNames.Contains(newLayerName))
            {
                NaroMessage.Show("Layer name already exist, please pick another!");
                Log.Info("The new layer cannot be added because of duplicate names");
                return;
            }
            DialogResult = true;
            if (_updateValue)
            {
                _container.LayerNames[_index] = newLayerName;
                Log.Info("Layer " + newLayerName + "added");
                _container.LayerColors[_index] = ShapeUtils.FromWpfColor(LayerColor);
            }
            Close();
        }
        public static void SaveShapeToStep(IEnumerable <TopoDSShape> shapes, string fileName)
        {
            var aWriter = new STEPControlWriter();

            foreach (var shape in shapes)
            {
                if (shape != null)
                {
                    aWriter.Transfer(shape, STEPControlStepModelType.STEPControl_ShellBasedSurfaceModel, true);
                }
            }

            var status = aWriter.Write(fileName);

            if (status == IFSelectReturnStatus.IFSelect_RetError ||
                status == IFSelectReturnStatus.IFSelect_RetFail)
            {
                NaroMessage.Show("Error has occured while saving to STEP format");
            }
        }
Example #3
0
        public static NodeBuilder ApplyToolOnOtherShape(Document document, Node sourceTool, Node destinationShape)
        {
            var oldTool = new NodeBuilder(sourceTool);
            var newTool = new NodeBuilder(document, sourceTool.Get <FunctionInterpreter>().Name);

            if (oldTool[0].Name != InterpreterNames.Reference && oldTool[0].Name != InterpreterNames.ReferenceList)
            {
                NaroMessage.Show("You should pick a tool as source selection");
                return(new NodeBuilder(null));
            }
            newTool[0].ReferenceData = new SceneSelectedEntity
            {
                Node       = destinationShape,
                ShapeCount = oldTool[0].ReferenceData.ShapeCount,
                ShapeType  = oldTool[0].ReferenceData.ShapeType
            };
            var result = SyncronizeNodeFunctions(sourceTool, ref newTool);

            return(result ? newTool : new NodeBuilder(null));
        }
Example #4
0
        public void PushValue(object data)
        {
            if (data == null)
            {
                return;
            }

            // Try to propose to the meta action the parameter value
            var dependency = _metaAction.Dependency;

            //Dependency.Inputs.Inputs[InputNames.FacePickerPlane].Send(NotificationNames.Resume);
            InitAnimateSession();

            if (!BridgedProposeDependency(data, dependency))
            {
                return;
            }

            var documentNodeBuilder = dependency.DocumentNodeBuilder;

            if (documentNodeBuilder != null &&
                documentNodeBuilder.LastExecute && dependency.StepName == InterpreterNames.Reference)
            {
                var dependencyNode = dependency.DocumentNodeBuilder[dependency.StepIndex];
                var step           = dependency.Steps[dependency.StepIndex];
                dependencyNode.ReferenceData = step.Get <SceneSelectedEntity>();
                if (!dependencyNode.IsValid)
                {
                    NaroMessage.Show(@"Tool does not work with this shape");
                    return;
                }
            }
            if (data is Mouse3DPosition)
            {
                Inputs[InputNames.CoordinateParser].Send(NotificationNames.SetLastPoint,
                                                         (data as Mouse3DPosition).Point);
            }
            dependency.PushCandidate();

            UpdateParserAndView(dependency);
        }
        private void InstallPluginClicked(object sender, RoutedEventArgs e)
        {
            var fileOpenDialog = new OpenFileDialog {
                Filter = "Naro Plugin Assembly (*.dll)|*.dll"
            };
            var result = fileOpenDialog.ShowDialog();

            if ((bool)(!result))
            {
                return;
            }
            var fileName = fileOpenDialog.FileName;

            if (!PluginUtil.IsNaroPlugin(fileName))
            {
                NaroMessage.Show("You should select a NaroCAD plugin!");
                return;
            }
            File.Copy(fileName, AppSettings.Instance.StartFolder);
            UpdatePluginList();
        }
        public override void OnActivate()
        {
            base.OnActivate();
            //if (Document.HistoryCount == 0)
            //    ExitFromApplication();
            var result = NaroMessage.Show("NaroCAD can now attempt to update. Do you want to save your work?",
                                          "Restarting NaroCAD",
                                          MessageBoxButtons.YesNoCancel);

            switch (result)
            {
            case DialogResult.Yes:
                SaveFile();
                break;

            case DialogResult.Cancel:
                BackToNeutralModifier();
                return;
            }
            RestartApplication();
        }
Example #7
0
        public static void Main(object data)
        {
            var logic = (UpdateLogic)data;

            Log.Info("Started updater logic");
            CalculateLengthOfNaroVersions();
            DeleteDirectory(FailedUpdateDirectory);
            VersionObject currentVersionData;

            try
            {
                currentVersionData = DeserializeFromXml(versionFileName);
            }
            catch
            {
                Log.Error("The versioning file is corrupt.");
                DeleteDirectory(AuxiliaryDirectory);
                DeleteFile(HelperVersioningFile);
                NaroMessage.Show("The versioning file is corrupt. It is recomanded to download and reinstall NaroCAD.");
                return;
            }
            CalculateNaroVersion(currentVersionData);
            if (MainUpdateWasJustDone())
            {
                if (AttemptToFinalizeUpdate(currentVersionData.GetListOfFiles(),
                                            DeserializeFromXml(HelperVersioningFile).GetListOfFiles()))
                {
                    Log.Info("NaroCAD update successfully compleated");
                    UpdaterWindowsManager.ShowDownloadsFinishedWindow(new List <string>
                    {
                        "",
                        "Update Successfully Compleated",
                        "Enjoy NaroCAD"
                    });
                    UpdaterWindowsManager.DownloadFinishedLoop();
                }
            }
            AttemptToDownloadUpdateFiles(_control);
        }
        public override void OnActivate()
        {
            DefaultInterpreters.Setup();

            UpdaterSetup();


            var somethingLoaded = false;

            try
            {
                if (NaroStartInfo.Instance.Arguments.Length > 0)
                {
                    var fileName = NaroStartInfo.Instance.Arguments[0];
                    if (File.Exists(fileName))
                    {
                        Document.LoadFromXml(fileName);
                        somethingLoaded = true;
                    }
                    else
                    {
                        NaroMessage.Show(ExtensionsResources.File_not_found_on_disk);
                    }
                }
            }
            catch
            {
                NaroMessage.Show(ExtensionsResources.Invalid_file_to_load);
            }
            if (!somethingLoaded)
            {
                RestoreAutoSavedFile();
            }
            Inputs[InputNames.SelectionContainerPipe].Send(NotificationNames.SwitchSelectionMode,
                                                           TopAbsShapeEnum.TopAbs_SOLID);

            BackToNeutralModifier();
        }
Example #9
0
 private void GlassButton1Click(object sender, EventArgs e)
 {
     DoRenderLogic();
     try
     {
         var proc = new Process
         {
             StartInfo =
             {
                 FileName    = "sunflow.exe",
                 Arguments   = "-o render.png render.sc",
                 WindowStyle = ProcessWindowStyle.Normal
             }
         };
         proc.Start();
     }
     catch (Exception ex)
     {
         NaroMessage.Show(ex.Message);
         return;
     }
     Close();
     WriteOptionsConfig();
 }
 private void WarnNoSelectedAndBackToNone()
 {
     NaroMessage.Show("Please pick a shape to switch action");
     BackToNeutralModifier();
 }
Example #11
0
 public void ShowInteger(int dataValue)
 {
     NaroMessage.Show(dataValue.ToString());
 }
Example #12
0
 public void ShowDouble(double dataValue)
 {
     NaroMessage.Show(dataValue.ToString());
 }
Example #13
0
 private static void SelectEdgeBeforeStartActionMessage()
 {
     NaroMessage.Show("Select_Edge_Before_Using");
 }
Example #14
0
 private void ErrorSplineSelected()
 {
     NaroMessage.Show(@"Please select a spline first");
     BackToNeutralModifier();
 }
 private void OnChange(Node pathnode)
 {
     NaroMessage.Show("In notification");
 }