private void refreshCanvas() { selectedShape = AvailableShapes.None; Hide(); Show(); restoreShapes(); }
public void Install(IWorkspace workspace) { // Add parts arGraph = new ActiveRecordGraphView(_model); arGraph.ParentWorkspace = workspace; outView = new OutputView(_model); outView.ParentWorkspace = workspace; projExplorer = new ProjectExplorer(_model); projExplorer.ParentWorkspace = workspace; avaShapes = new AvailableShapes(_model); avaShapes.ParentWorkspace = workspace; // Register Actions FileActionGroup group1 = new FileActionGroup(); group1.Init(_model); group1.Install(workspace); ViewActionSet group2 = new ViewActionSet(arGraph, outView, projExplorer, avaShapes); group2.Init(_model); group2.Install(workspace); HelpActionSet group3 = new HelpActionSet(); group3.Init(_model); group3.Install(workspace); }
public ViewActionSet(ActiveRecordGraphView graph, OutputView outputview, ProjectExplorer explorer, AvailableShapes shapes) { _graph = graph; _outputview = outputview; _explorer = explorer; _shapes = shapes; }
// Select the 'Clear Canvas' button to clear all drawings private void button9_Click(object sender, EventArgs e) { foreach (Shape shape in shapes.ToArray()) { removeShape(shape); } selectedShape = AvailableShapes.None; Hide(); Show(); }
public Form2(Form mainMenu) { InitializeComponent(); selectedShape = AvailableShapes.None; shapeToEdit = null; shapes = new List <Shape>(); shapeNumIncrement = 1; name = "Canvas " + CanvasManager.GetNumIncrement(); graphics = panel1.CreateGraphics(); this.mainMenu = mainMenu; loc = new Location(0, 0); canDraw = false; }
public ViewAvailableItemsAction(AvailableShapes availableShapes) { _availableShapes = availableShapes; }
private void button5_Click(object sender, EventArgs e) { mainMenu.Show(); Hide(); selectedShape = AvailableShapes.None; }
private void button4_Click(object sender, EventArgs e) { MessageBox.Show("Pick a position with mouse on canvas!", "OK", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); selectedShape = AvailableShapes.Circle; canDraw = true; }
//#region A Property //private double _A; //public double A //{ // get { return _A; } // set // { // _A = value; // } //} //#endregion //#region d Property //private double _d; //public double d //{ // get { return _d; } // set // { // _d = value; // } //} //#endregion //#region Ht Property //private double _Ht; //public double Ht //{ // get { return _Ht; } // set // { // _Ht = value; // } //} //#endregion //#region D Property //private double _D; //public double D //{ // get { return _D; } // set // { // _D = value; // } //} //#endregion //#region bf Property //private double _bf; //public double bf //{ // get { return _bf; } // set // { // _bf = value; // } //} //#endregion //#region B Property //private double _B; //public double B //{ // get { return _B; } // set // { // _B = value; // } //} //#endregion //#region b Property //private double _b; //public double b //{ // get { return _b; } // set // { // _b = value; // } //} //#endregion //#region tw Property //private double _tw; //public double tw //{ // get { return _tw; } // set // { // _tw = value; // } //} //#endregion //#region tf Property //private double _tf; //public double tf //{ // get { return _tf; } // set // { // _tf = value; // } //} //#endregion //#region tnom Property //private double _tnom; //public double tnom //{ // get { return _tnom; } // set // { // _tnom = value; // } //} //#endregion //#region t Property //private double _t; //public double t //{ // get { return _t; } // set // { // _t = value; // } //} //#endregion //#region x Property //private double _x; //public double x //{ // get { return _x; } // set // { // _x = value; // } //} //#endregion //#region y Property //private double _y; //public double y //{ // get { return _y; } // set // { // _y = value; // } //} //#endregion //#region eo Property //private double _eo; //public double eo //{ // get { return _eo; } // set // { // _eo = value; // } //} //#endregion //#region xp Property //private double _xp; //public double xp //{ // get { return _xp; } // set // { // _xp = value; // } //} //#endregion //#region yp Property //private double _yp; //public double yp //{ // get { return _yp; } // set // { // _yp = value; // } //} //#endregion //#region X-axis //#region Ix Property //private double _Ix; //public double Ix //{ // get { return _Ix; } // set // { // _Ix = value; // } //} //#endregion //#region Zx Property //private double _Zx; //public double Zx //{ // get { return _Zx; } // set // { // _Zx = value; // } //} //#endregion //#region Sx Property //private double _Sx; //public double Sx //{ // get { return _Sx; } // set // { // _Sx = value; // } //} //#endregion //#region rx Property //private double _rx; //public double rx //{ // get { return _rx; } // set // { // _rx = value; // } //} //#endregion //#endregion //#region Y-axis //#region Iy Property //private double _Iy; //public double Iy //{ // get { return _Iy; } // set // { // _Iy = value; // } //} //#endregion //#region Zy Property //private double _Zy; //public double Zy //{ // get { return _Zy; } // set // { // _Zy = value; // } //} //#endregion //#region Sy Property //private double _Sy; //public double Sy //{ // get { return _Sy; } // set // { // _Sy = value; // } //} //#endregion //#region ry Property //private double _ry; //public double ry //{ // get { return _ry; } // set // { // _ry = value; // } //} //#endregion //#endregion //#region Z-axis //#region Iz Property //private double _Iz; //public double Iz //{ // get { return _Iz; } // set // { // _Iz = value; // } //} //#endregion //#region Sz Property //private double _Sz; //public double Sz //{ // get { return _Sz; } // set // { // _Sz = value; // } //} //#endregion //#region rz Property //private double _rz; //public double rz //{ // get { return _rz; } // set // { // _rz = value; // } //} //#endregion //#endregion //#region Torsional properties //#region J Property //private double _J; //public double J //{ // get { return _J; } // set // { // _J = value; // } //} //#endregion //#region Cw Property //private double _Cw; //public double Cw //{ // get { return _Cw; } // set // { // _Cw = value; // } //} //#endregion //#endregion #endregion #region Display parameters private void FetchList(string ResourceFileName, string FilterCriteriaString, string ShapeGapString = null) { if (FilterCriteriaString != null && ResourceFileName != null) { if (AvailableShapes == null) { AvailableShapes = new ObservableCollection <string>(); } else { AvailableShapes.Clear(); } //Replace "_" and "I" in the filter criteria string FilterCriteria1 = FilterCriteriaString.Replace("_", "-"); string FilterCriteria2 = FilterCriteria1.Replace("I", "/"); string FilterCriteria3 = FilterCriteria2.Replace("z", "."); string FilterCriteria = FilterCriteria3.Replace("Angle", ""); string Gap = null; if (ShapeGapString != null) { string Gap1 = ShapeGapString.Replace("_", "-"); string Gap2 = Gap1.Replace("I", "/"); string Gap3 = Gap2.Replace("z", "."); Gap = Gap3.Replace("Angle", ""); } //string UriString = string.Format("pack://application:,,,/Resources/{0}.txt", ResourceFileName); //StreamResourceInfo sri = Application.GetResourceStream(new Uri(UriString)); string resourceName = string.Format("KodestructDynamoUI.Resources.{0}.txt", ResourceFileName); var assembly = Assembly.GetExecutingAssembly(); using (Stream stream = assembly.GetManifestResourceStream(resourceName)) { string line; //using (TextReader tr = new StreamReader(sri.Stream)) using (TextReader tr = new StreamReader(stream)) { List <string> AllShapes = new List <string>(); while ((line = tr.ReadLine()) != null) { //AvailableShapes.Add(line); AllShapes.Add(line); } if (FilterCriteria != null) { if (Gap == null) //no shape gap { if (FilterCriteria.Contains("Pipe")) { var FilteredList = AllShapes.Where(sh => { if (sh.Contains(FilterCriteria)) { return(true); } else { return(false); } } ).ToList(); foreach (var s in FilteredList) { AvailableShapes.Add(s); } } else { var FilteredList = AllShapes.Where(sh => { string[] subsStr = sh.Split(new string[] { "X" }, StringSplitOptions.None); if (subsStr[0] == FilterCriteria) { return(true); } else { return(false); } //sh.Contains(FilterCriteria) } ).ToList(); foreach (var s in FilteredList) { AvailableShapes.Add(s); } } } else //if gap is defined { var FilteredListWithGap = AllShapes.Where(sh => { string[] subsStr = sh.Split(new string[] { "X" }, StringSplitOptions.None); if (subsStr[0] == FilterCriteria) { if (subsStr.Length == 3) //no gap is defined { return(false); } else { if (subsStr.Length == 4) { string GapStr = ""; if (subsStr[3].Contains("SLBB") || subsStr[3].Contains("LLBB")) { GapStr = subsStr[3].Substring(0, subsStr[3].Length - 4); } else { GapStr = subsStr[3]; } if (GapStr == Gap) { return(true); } else { return(false); } } else { return(false); } } } else { return(false); } //sh.Contains(FilterCriteria) } ).ToList(); foreach (var s in FilteredListWithGap) { AvailableShapes.Add(s); } } } else { foreach (var s in AllShapes) { AvailableShapes.Add(s); } } } } } }