private void Line_tool_Click(object sender, EventArgs e) { if (ImagePropertiesClass.scale_set) { form_linedetails = new LineDetails(); currentpen = Commonforallfunctions.getdefaultpen();//set default pen if (form_linedetails.ShowDialog() == DialogResult.OK)//if form was successfully closed { //call function to disable appropriate controls functiontime_settools(false);//set the tools enable property to false this.Cancel_tool.Enabled = true; this.LineStyle_tool.Enabled = true; Commonforallfunctions.setlinebool(true); Commonforallfunctions.setdrawbool(true); Commonforallfunctions.setRecordpointsbool(true);//to indicate that points clicked are to be recorded in list. line_class = new Line(); line_class.line_name = form_linedetails.setlinename();//get the line name. Console.WriteLine("Line name is:" + line_class.line_name);//debugging purpose // line_thread = new LineCalculation_Thread();//start the thread multipointline_thread = new AreaCalculation_Thread(); calculationfinish_Thread = new Thread(this.run);//thread started to see when above thread is finished. calculationfinish_Thread.Start(); LineStyle_tool.Enabled = true;//enabled so that linestyle can be chosen } } else { MessageBox.Show("Scale is to be set First \n Click on \"SetScale\" to set the scale", "You are missing something!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void Area_tool_Click(object sender, EventArgs e) { if (ImagePropertiesClass.scale_set) { form_areadetails = new AreaDetails(); currentpen = Commonforallfunctions.getdefaultpen();//to set default pen functiontime_settools(false);//set the tools enable property to false this.Cancel_tool.Enabled = true; Commonforallfunctions.setareabool(true); Commonforallfunctions.setdrawbool(true); Commonforallfunctions.setRecordpointsbool(true);//to indicate that points clicked are to be recorded in list. if (form_areadetails.ShowDialog() == DialogResult.OK) { area_class = new Area(); this.LineStyle_tool.Enabled = true; area_class.area_name = form_areadetails.setareaname(); area_thread = new AreaCalculation_Thread(); Console.WriteLine("Area name is:" + area_class.area_name);//debugging purpose calculationfinish_Thread = new Thread(this.run);//thread started to see when above thread is finished. calculationfinish_Thread.Start(); } } else { MessageBox.Show("Scale is to be set First \n Click on \"SetScale\" to set the scale", "You are missing something!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }