Microsoft Equation

Similar documents

NECTAR. ThТs work has bооn submтttоd to NECTAR, thо Northampton Electronic Collection of Theses and Research. Conference or Workshop Item

О Њ О О О О О Л К КОЛ Ј Л Ћ О КОЛ К 7/2018. О - 1

-. (Mr R. Bellin),.: MW224r

PORTFOLIO OF KHALITOVA LILIA

TVT Television Technologies. TVT Television Technologies.: (812)

CALCULATOR APPLICATION

VI... VIII

Now find the button component in the tool box. [if toolbox isn't present click VIEW on the top and click toolbox]

Ы Ш Илт :. у /Ph.D/,Х И, у лт л д д л. лдул /Ph.D/, Х И, к л өтөл ө л

C# winforms gridview

Object oriented lab /second year / review/lecturer: yasmin maki

CSIS 1624 CLASS TEST 6

«, 68, 55, 23. (, -, ).,,.,,. (workcamps).,. :.. 2

First start a new Windows Form Application from C# and name it Interest Calculator. We need 3 text boxes. 4 labels. 1 button

IBSDK Quick Start Tutorial for C# 2010

You can call the project anything you like I will be calling this one project slide show.

«А з» -..,,.,,,, ; ё ; ё.,,, (,, - ),,,,. : 1.,,,, -,,,,. ~ 5 ~

C:\homeworks\PenAttention_v13_src\PenAttention_v13_src\PenAttention4\PenAttention\PenAttention.cs 1 using System; 2 using System.Diagnostics; 3 using

, «Ruby»..,

3-tier Architecture Step by step Exercises Hans-Petter Halvorsen

To start we will be using visual studio Start a new C# windows form application project and name it motivational quotes viewer

Representing Recursive Relationships Using REP++ TreeView

Land Acquisition and Resettlement Plan. Kyrgyz Republic: Power Sector Improvement Project

APSNIM, 2017, :1 (13) Ukrainian Literature (АПС І ), 2017, 1 (13), P (Constantin Dobrogeanu-Gherea) «е че о»

Mainly three tables namely Teacher, Student and Class for small database of a school. are used. The snapshots of all three tables are shown below.

Answer on Question# Programming, C#

II. Programming Technologies


Using Template Bookmarks for Automating Microsoft Word Reports

Experiment 5 : Creating a Windows application to interface with 7-Segment LED display

Class Test 5. Create a simple paint program that conforms to the following requirements.

The Open Core Interface SDK has to be installed on your development computer. The SDK can be downloaded at:

Writing Your First Autodesk Revit Model Review Plug-In

Click on the empty form and apply the following options to the properties Windows.

Visual Basic/C# Programming (330)

if (say==0) { k.commandtext = "Insert into kullanici(k_adi,sifre) values('" + textbox3.text + "','" + textbox4.text + "')"; k.

1 de :02

Brian Kiser November Vigilant C# 2.5. Commonwealth of Kentucky Frankfort, Kentucky

string spath; string sedifile = "277_005010X228.X12"; string sseffile = "277_005010X228.SemRef.EVAL0.SEF";

Start Visual Studio, start a new Windows Form project under the C# language, name the project BalloonPop MooICT and click OK.

// Specify SEF file to load. oschema = (edischema) oedidoc.loadschema(spath + sseffilename, SchemaTypeIDConstants. Schema_Standard_Exchange_Format);

عنوان مقاله : خواندن و نوشتن محتوای فایل های Excel بدون استفاده ازAutomation Excel تهیه وتنظیم کننده : مرجع تخصصی برنامه نویسان

Form Properties Window

ОЉА ВА СИ ЛЕ ВА, ро ђе на у Бе о гра ду. Про у ча ва срп ску поези ју

We are going to use some graphics and found a nice little batman running GIF, off course you can use any image you want for the project.

private string sconnection = ConfigurationManager.ConnectionStrings["Development"].ConnectionString

Campo Minato Nel Form1 sono presenti i seguenti componenti:

к ри т и к у, о б ја в љу је у пе ри о д и ц и. у Но в ом С а д у. Ис т о р и ч а р к а је у ме т нос т и, ш колов ал а с е у Б еог р ад у и

MVC - Repository-And-Unit-Of-Work

БРАН КО БАЉ, ро ђен у Ли па ру код Ку ле. Фи ло зоф, пи ше

Start Visual Studio and create a new windows form application under C# programming language. Call this project YouTube Alarm Clock.

Main Game Code. //ok honestly im not sure, if i guess its a class ment for this page called methodtimer that //either uses the timer or set to timer..

} } public void getir() { DataTable dt = vt.dtgetir("select* from stok order by stokadi");

private string sconnection = ConfigurationManager.ConnectionStrings["Development"].ConnectionString

In-Class Worksheet #4

เว บแอพล เคช น. private void Back_Click(object sender, EventArgs e) { this.webbrowser2.goback(); }

Datalogging and Monitoring

Eyes of the Dragon - XNA Part 37 Map Editor Revisited

Huw Talliss Data Structures and Variables. Variables

For this example, we will set up a small program to display a picture menu for a fast food take-away shop.

Custom Control Tutorial

Start Visual Studio, create a new project called Helicopter Game and press OK

UNIT-3. Prepared by R.VINODINI 1

namespace csharp_gen277x214 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }

بسم هللا الرحمن الرحيم المحاضرة السابعة مستوى ثالث علوم حاسوب برمجة مرئية 2 )عملي ) جامعة الجزيرة محافظة اب الجمهورية اليمنية النافذة الرئيسية

// Specify SEF file to load. edischema oschema = oedidoc.loadschema(spath + sseffilename, SchemaTypeIDConstants. Schema_Standard_Exchange_Format);

Huawei Enterprise IT. К о ко. текто е е

EDB Postgres Advanced Server.NET Connector Guide

This is the empty form we will be working with in this game. Look under the properties window and find the following and change them.

Hands-On Lab. Lab: Client Object Model. Lab version: Last updated: 2/23/2011

XNA 4.0 RPG Tutorials. Part 11b. Game Editors

СР ЂА Н ВИД РИ Ћ, рођен у Зрења н и н у. П и ше есе је и к њи жев н у к ри т и к у, о б ја в љу је у пе ри о д и ц и.

Chapter 2. Ans. C (p. 55) 2. Which is not a control you can find in the Toolbox? A. Label B. PictureBox C. Properties Window D.

Create your own Meme Maker in C#

2 і К К Ч... 5 Т 6 1. Ч Т КТ Т Т і і і і і і Т я я і і і і 27 К ЄКТ Т Т К 'є і і я і і.

EDB Postgres Advanced Server.NET Connector Guide

EDB Postgres Advanced Server.NET Connector Guide

XNA 4.0 RPG Tutorials. Part 24. Level Editor Continued

Class Test 4. Question 1. Use notepad to create a console application that displays a stick figure. See figure 1. Question 2

Chromatic Remote Control Product Guide Executive Way, Suite A Frederick, MD 21704

RUBIUS PM

Yes, this is still a listbox!

ЕНГЛЕСКИ ФРАЗНИ ГЛАГОЛИ СА ПАРТИКУЛОМ ОUТ И ЊИХОВИ ПРЕВОДНИ ЕКВИВАЛЕНТИ У СРПСКОМ

LISTING PROGRAM. // // TODO: Add constructor code after the InitializeComponent() call. //

articy:draft API - Programmer s Guide

Question 2. [5 points] Given the following symbolic constant definition

// Precondition: None // Postcondition: The address' name has been set to the // specified value set;

In this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics.

JOINT-STOCK COMPANY GIDROPRIVOD. RADIAL PISTON PUMPS OF VARIABLE DISPLACEMENT type 50 НРР

Computer measurement and control

The first program we write will display a picture on a Windows screen, with buttons to make the picture appear and disappear.

Stichos: Out of the depths have I cried unto Thee, O Lord, / O Lord, hear my voice..

МЕН ТАЛ НА ПО ВРЕ ДА ПУТ НИ КА КАО ОСНОВ ОД ГО ВОР НО СТ И П РЕ ВО ЗИ О Ц А У М Е ЂУ Н А РОД НОМ ВА ЗД У ХО П ЛОВ НОМ П РА ВУ

Bachelor s Thesis: Building Web Application for Mahabad University Graduate Affairs Afsaneh Nezami Savojbolaghi

namespace csharp_gen837x223a2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }

Visual Studio.NET.NET Framework. Web Services Web Forms Windows Forms. Data and XML classes. Framework Base Classes. Common Language Runtime

Developing for Mobile Devices Lab (Part 1 of 2)

ИЗ МЕ ЂУ СЕ ЛИН ЏЕ РА И ЏОЈ СА: ОМ И ЉЕ Н А И Г РА Л Е О Н А Р Д А КО Е Н А

Name of Experiment: Student Database

Transcription:

2

... 5 1 -... 7 1.1... 7 1.2... 9 1.3... 10 1.3.1... 10 1.4... 12 1.4.1 Microsoft Equation 3.0... 13 1.4.2 MathType... 14 1.5 1... 15 2... 17 2.1... 17 2.1.1... 17 2.1.2... 18 2.1.3... 19 2.1.4... 19 2.2... 20 2.2.1... 20 2.2.2... 22 2.2.3... 30 2.3... 32 2.3.1... 32 2.3.2... 33 2.4 2... 36... 37... 38 3

... 39... 41... 42... 49... 83 4

.,,.,. - [4],.,,.,.,,,,,.,. ( ).,,. 5

.,, ( ) ( ).,.,,,,.,.. 6

1 - ( )...,. 1.1. [3], ё,,, 70- XX.,,. ( ), ё,,,,, 7

. -,.,.,, ё ;,.,,., -..,,.,,,., -. 8

1.2...,,,,,. ( ). /GPS., - [5], -,,,,. 9

1.3 [1],...,,,. ё :. -,,,... ё,. 1.3.1,, [2]., 10

,, ( ). ( ),,,..,.. ( ).,,.,,.. -.,,,.., 11

,. 1. 2 3 4 9 10 5 1 6 7 8-1 1.4,,,,. : a) ; b) ; c). 12

1.4.1 Microsoft Equation 3.0 Microsoft Equation [6] Design Science. Microsoft, Word, PowerPoint, Excel.,. 150 120,,..,.,,.,., Microsoft Equation,,,. 2 Microsoft Equation 3.0 13

1.4.2 MathType MathType [6].,. 350 -, : Microsoft Office, MATLAB, Wikipedia, Mathematica, Gmail, Maple, Google Docs, OpenOffice, Mathcad, Adobe InDesign. 3 MathType, ( 500 :,,,,,, ). 14

: a),, ; b) ; c),,, MathType ; d) Word PowerPoint; e), MathType; f). 1.5 1,,,..,, : a) ; b) (,,, ),, (,,, ),,,. c) ; d) ; e) ; 15

: a). b) ; c) ; d) ; e) ; a). 16

2 2.1 2.1.1 C# [12],,.,,. C#. -,. C#,, 80%.. C#.,. C#. ++,, - -,,. 17

C#, CIL,. C# Microsoft Visual Studio. Visual Studio, ReSharper JetBrains NuGet. 2.1.2, : a) ; b) (,, ); c) ; d). # [10].,,.. Windows Forms API,,. [13] Entity Framework.,,, ConnectionString DBContext.,. 18

2.1.3,,. : SQL NoSQL [7]. NoSQL : a) «-»; b) ; c) - ; d). (, -, Google Maps..). SQL. : MySql, PostgreSql, SQL Server. MySql PostgreSql.. MySql,, PostgreSql.. SQL Server Microsoft,,. Windows. 2.1.4 : 19

a) Windows Forms; b) C#; c) SQL Server, C#, Visual Studio Windows. 2.2 : a) ; b) ; c). 2.2.1,,. : a) ; b) ; c) ; d),,, ; e) (,, ); f) ( ).., 20

:,,,,,,, ( 4). 4,., ( 5). 5 21

,,,., ( 6). 6 2.2.2 ( )., 7. 7 22

8 -. Н ло Calculate Фо ул, лк т оку дл от ед кт о о о ул, п ок пе е е Уд ле е о ул п о ело екото е ее п ео о е (к т о ол, е sqlr к ко, pi ол п ) Нет л кол е т о ле п ко ок о уле о п д ет е т оот ет т у ее оо е е о о к о д е о ект лек е дл о т ок о ул лек е д т е у т оку о уло GetToken(О ект лек е ) ( о о ул лек е ) о е е пу то о е ул т т CalcToken(О ект лек е ) ( ет по о уле о о е лек е ) о е е полу е о о е ул т т 8-23

. ln5+ 2., ((2*ln(5)+3.2)^2)/3. : «(», «(», «2», «/», «ln», «(», «5», «)», «+», «3.2», «)», «^», «2», «)», «/», «3»., ( ),. ( 9),,,, ( ) ( ). 9 (, «*» «/», «+» «-»),.,,,. - 10. 24

Н ло OpenBr т ок т о ул, дл поп тк к т ко ок од т е кол е т о ле п ко ок т оке л ло ко ок т ло до ко т ок Нет Уд л т к е ко к т ок е ут е е е у т оку е ут полу е у т оку 10 - ( ),., 11. 2,. 25

_1 action= / lec= ((2*ln(5)+3.2)^2)/3 parent=null left= _2 right= _3 _2 action= ^ lec= (2*ln(5)+3.2)^2 parent= _1 left= _4 right= _5 _3 action=null lec= 3 parent= _1 left=null right=null _4 action= + lec= 2*ln(5)+3.2 parent= _2 left= _6 right= _7 _5 action=null lec= 2 parent= _2 left=null right=null _6 action= * lec= 2*ln(5) parent= _4 left= _8 right= _9 _7 action=null lec= 3.2 parent= _4 left=null right=null _8 action=null lec= 2 parent= _6 left=null right=null _9 action= ln lec= ln(5) parent= _6 left=null right= _10 _10 action=null lec= 5 parent= _9 left=null right=null 11 ln5+ 2 26

12 -. Н ло GetToken О ект лек е л е ко ок т оке де опе то «+» л «-» Нет л е ко ок т оке де опе то л «/» Нет л у ко ок е ко ок т оке де опе то «^» Нет OpenBr( од т к лек е ) дл ле о п о т, от о тел о опе то ( к ет ко к, е л то ео од о) OpenBr( од т к лек е ) дл п о т, от о тел о опе то ( к ет ко к, е л то ео од о) л е ко ок т оке де у опе то Нет л т оке де ол п е е е л п GetToken(О ект лек е ) дл ле о п о лек е, от о тел о опе то ( к ет ко к, е л то ео од о) GetToken(О ект лек е ) дл п о лек е, от о тел о опе то ( к ет ко к, е л то ео од о) 12-27

.,, ( 13). 13,, ( 14). 14 28

15. Н ло CalcToken О ект лек е л то опе то Нет л то у опе то Нет е е о е пе е е по к оот ет т о е е лек е CalcToken(Ле т лек е ) опе то CalcToken( т лек е ) Опе то (CalcToken( т лек е )) п т лек е у е е пе е е о л оот ет т е де о Нет л лек е то е ло е т о ку Нет е ут е е лек е е ут е е NaN (Не ло) 15-29

2.2.3. : ( 16). 16 ( ),,.,,,. Entity Framework, [28].,,, ( ), ( 17). 17 30

Entity Framework app.config. ConnectionString. app.config ( 18). 18 ( 19). 19,. ( 20) 20 ConnectionString., ( 21). app.config,. 31

21 «Save eq-on»,,,,,. FormulaID,, linq [11], 22,,. 22 2.3 2.3.1 Windows 7 SQL Server.. 32

2.3.2, ( 23). 23.,, 2 24. 33

24,.. «Val»,, «+». ( 25). 25 34

,., ( 26). 26,,. «Fs»,. «Save eq-on». ( 27).,.,,. 27 35

, «Fs» «Back»,, «Save eq-on» «Update», ( 28). 28 2.4 2, Visual Studio 2013, C# 5.0, Entity Framework, Windows Forms..,,.. ( ),. 36

. C# 5.0, Visual Studio 2013, Entity Framework, Windows Forms. : a) ; b) (,,, ),, (,,, ),,,. c) ; d) ; e) ; f) ; g) ; h) ; i) ; j). 37

38

1.,.. /..,..,.. // 2016. 6 (113).. 89 98. 2.,.. /..,..,.. //. :. 2014.. 7. 8.. 984 989. 3... // : :... XIV - 3(14). URL: https://sibac.info/archive/meghdis/3(14).pdf 4.,.. - /..,..., 2016. 1 12. 5.,.. //..,..,..,..., 2001. 53. 6.,.. //..,..,..., 2006. 352. 7.,.. Microsoft SQL Server 6.5. //....:, 1997. 366. 39

8.,.. SQL: /..,..,... : BHV, 2005. 960. 9... : /..,..,... -.:, 2012. 400 c. 10.. Microsoft SQL-Server 2012.. Microsoft:.. /.,.,...:, 2014. 816. 11.,. LINQ. C# 2010 /,., 2011. 656. 12.,. C#. /., 2011. 602. 13.,. CLR via C#. Microsoft.NET Framework 2.0 C# /., 2017. 896. 14. 19701-90.,,.. 01.01.1992. :, 1990. 23 c. 15. 4.2 07 2014.,. 2014. :, 2014. 60. 16. 7.1 2003.... 01.07.2014.:., 2004. 48. 40

UML 41

- Н ло showdata Н ло Formulas_SelectedIndexChanged Н ло FormulaUse_FormClosed одкл е е к е полу е е п к о ул пе е е к О ект, о т е, у е т о т О ект, о т е, у е т о т GenVars(Но о о ул ) (Ото ет пе е е е дл о о ул ) Ото е е ок ед кто о ул Ото е е пе е е п ел дл о о ул Н ло Formulas_MesureItem Н ло Formulas_DrawItem Н ло GenVars О ект, о т е, у е т о т О ект, о т е, у е т о т Но е о ул п к о ул У ел е е е е к, е л о ул ет о о е т д е д е о пл ет тек т дл п к о ул Уд ле е е пе е е п ел дл о ул, ото е е пе е е о о ул, п ед тел о д т л.1-42

Н ло EditValue Н ло RemoveFormula_Click Н ло RemoveFormula_Click О ект, о т е, у е т о т О ект, о т е, у е т о т О ект, о т е, у е т о т о д е п ок пе е е о о е пе е е дл о о ул Calculate(Фо ул, лк пу ту т оку, п ок пе е е ) о к о ул е д, по етк пе е е о ул е д уд ле е, пол е е т к уд ле е о ул п к о ул о е е о улу пе е е у дл д л е е по е од тел к ок о, к т е теку е о ок ото е е ок ед кто о ул од е ул т т ет по о уле Н ло GetSFID Н ло RemoveFormula_Click Н ло FormulaUse_VisibleChanged о е е пе е е о о о ул о е по ле ед кт о о ул О ект, о т е, у е т о т о е е пе е е у о о ул полу е у о улу л ок о т ло д о ул л от ед кт о Нет е еп е у о улу от ед кт о о.2-43

Н ло Program Main Н ло Calculator Ко т укто Н ло Variable Ко т укто Отк т е ок ед кто о ул л ко по е то о ел, поло е е по е т к л, о е пе е е о Н ло Delete Уд ле е пе е е о ( к опок п к е ) д леду пе е е ( е ) ед у е ( ед у е е) Н ло ToVars е е п к пе е е дл ет по о уле CreateHeader ( е е оло ко ) GenerateCalculator ( е е оде о о к л кул то ) Н ло DeleteVar О ект, о т е, у е т о т о д е к опк до ле пе е е о, тек то о о пол дл е е пе е е о, пол дл е е е пе е е о, к опк ед кт о пе е е о к опк уд ле пе е е о. д е т ле пе е е подп е о т : Н т е к опку е е EditVarName ( е е е е пе е е о ) Н т е к опку уд ле пе е е о DeleteVar (Уд ле е пе е е о Н т е к опку до ле пе е е о CalcButtonClick ( о ле е пе е е о поле од о ул ) е е е е пе е е о CalcStr ( е е ет е о ул о е е пе е е о ) Н ло EditVarName о е е п к пе е е Delete() (Уд ле е пе е е о ) О ект, о т е, у е т о т Н ло ClearFormulaArea Н ло RemoveCh Отк то поле ед кт о е пе е е о Нет О ект, о т е, у е т о т О ект, о т е, у е т о т к т е ок ед кт о е пе е е о Отк т е поле ед кт о е пе е е о О тк пол ед кт о о ул Уд ле е ол, ле от ку о. д ку о од ол ле о.3-44

Н ло GenerateCalculator Н ло CalcButtonClick Н ло CalcStr CreateCalcButton(К опк, поло е е по е т к л о о т л, е е) дл е о д е к опок ок е ед кто о ул ( д ет о о е т л к опк подп ет о т е alcbuttonclick Отп е к опк,, «Val», «Save eqon», «Fs», «Back» от о т CalcButtonClick подп е : - ClearFormulaArea (О тк пол од о ул ), - RemoveCh (Уд ле е ол, ле от ку о ), «Val» - ValClick (От т е п ел от пе е е ), «Save eq-on» - FormulaToDB ( о е е о ул у д ), «Fs» - ShowFs (Отк т е ок те е дл от о ул, «Back» - BackToFU ( е ут к ок у от о ул ). О ект, о т е, у е т о т л е т е у т ко к о л е е е к опк поле ед кто о ул, от ку о. Ку о д ет к ко у еде о о е Нет о л е к е к опк отк у ко ку О ект, о т е, у е т о т ToVars() ( олу е е п к пе е е ) Calculate(Фо ул, лк т оку дл е ул т т п ео о о ул, п ок пе е е е е поле ед кт о о ул полу е ое по лке то о о у е т етод Calculate п е ул т т ет по о уле поле е ул т т ет по о уле Н ло Val_Click Н ло CreateRoundedRectangle Н ло CreateRoundedRectangle О ект, о т е, у е т о т К опк, коо д т, е е дл к опк Коо д т, е, ко е т к у ле п оу ол к Нет л п ел ед кт о пе е е отк т CreateRoundedRectangle(Нуле е коо д т, е к опк, ко е т к у ле к е ) ( о д ет л у к опк ) о д е л, о о у у (дл к опок о о ок ед кто о ул) Отк т п ел ед кт о пе е е к т п ел ед кт о пе е е д е т, е, коо д т, е, ет к опк подп е о т е т к опку CalcButtonClick ( о ле е е поле ед кто о ул ) о т л.4-45

Н ло Calculator_MouseDown Н ло CreateHeader Н ло Hide_Click О ект, о т е, у е т о т От е о о о т о ект отп к о от ку оо е Windows оо е о пе ет к ок Н ло Cls_Click О ект, о т е, у е т о т к т ок о CreateRoundedRectangle(Коо д т ок, е ок, ко е т к у ле к е ) ( о д е о к у ле к о ле е т ле, ко к, оло к, к опок к т о ок дл оло ок ок. одп е о т : Н т к опк к т Cls_Click ( к т е ок ), Н т к опк о Hide_Click ( о е ок ), т е к опк ко ке л оло ке Calculator_MouseDown ( е ет к е о ) Н ло Help_Click О ект, о т е, у е т о т Отк т е ок п к О ект, о т е, у е т о т е ут ок о Н ло FormulaArea_Leave О ект, о т е, у е т о т о е е поло е ку о поле ед кто о ул пе ед пок д е пол Н ло button1_click Н ло ShowFs О ект, о т е, у е т о т о ле е пе е е о пе ел ед кт о пе е е Н ло BackToFU О ект, о т е, у е т о т О ект, о т е, у е т о т ок т е теку е о ок отк т е ок от о ул rback() ( е екл ет ок о от о ул ).5-46

Н ло FormulaToDB Н ло rback О ект, о т е, у е т о т Уд ле е е пе е е, ок т е теку е о ок ото е е ок от о ул одкл е к д по д о т оке оед е Нет л о д ет о о ул Н ло ChangeServDB_Click о е т пе е е е д о о ул е уд ле е т т е е о ул О ект, о т е, у е т о т о е е е е е д, о д е о ект о ул п е о о ул, до ле е е о п к пе е е п пе е е тот п ок AddOrUpdate(О ект о ул ) (до ле е л о о ле е о ул е л то е е е о ул Нет Уд ле е т пе е е, пол е е пол о ул, е ул т т, п к пе е е е ед кт уе о о ул о е е е е од пл е о ок оо е е о о е о ул Н ло одtoolstripmenuitem_click л о ул ед кт о л SetSF(О ект о ул ) ( е еп ет о улу ок е от о ул ) Нет О ект, о т е, у е т о т к т е ок rback() ( е екл ет ок о от о ул ).6-47

Н ло Help_FormClosed Н ло Val_Click О ект, о т е, у е т о т О ект, о т е, у е т о т Ото е е ок ед кто о ул Ото е е о о к опке «Val» Н ло SaveEq_Click Н ло Fs_Click О ект, о т е, у е т о т О ект, о т е, у е т о т Ото е е о о к опке «Save eq-on» Ото е е о о к опке «Fs» Н ло ChangeServDB Н ло Apply_Click олу е е п к е е о ото е е п к ок е о е е О ект, о т е, у е т о т о е е е о о е е.7-48

Л Calculator.cs using System; using System.Collections.Generic; using System.Drawing; // using System.Drawing.Drawing2D; // 2D using System.Windows.Forms; // using System.Configuration; using System.Data.Entity; using System.Data.Entity.Migrations; using System.Linq; // Dipl namespace Dipl //, public partial class Calculator : Form private Form th; private static Button AV; private static TextBox FA; private static TextBox RFA; public static int EditFormulaID = -1; public Calculator() // InitializeComponent(); // CreateHeader(); // GenerateCalculator(); // th = this; AV = AddVarButton; FA = FormulaArea; RFA = ResultFormulaArea; static List<Variable> Variables = new List<Variable>(); public class Variable public Variable(Panel VP, int y, decimal Value) index = y; bvar = new Button(); 49

EditName = new TextBox(); Name = new Button(); delete = new Button(); Val = new NumericUpDown(); if (Variables.Count!= 0) bvar.top = Name.Top = delete.top = EditName.Top = Val.Top = Variables[Variables.Count - 1].bVar.Top + 30; else bvar.top = Name.Top = delete.top = EditName.Top = Val.Top = 40; Name.Text = EditName.Text = "a" + y; for (int i = 0; i < Variables.Count; i++) if (Variables[i].Name.Text == Name.Text) Name.Text += "_1"; Name.Top -= 2; bvar.backcolor = Color.CornflowerBlue; bvar.backgroundimage = Properties.Resources.gear; bvar.backgroundimagelayout = ImageLayout.Center; bvar.text = " "; bvar.font = new Font("Microsoft Sans Serif", 1); bvar.flatstyle = FlatStyle.Popup; bvar.height = bvar.width = 26; bvar.left = 2; EditName.Height = Name.Height = 30; EditName.Left = Name.Left = bvar.right; EditName.Width = Name.Width = 50; EditName.Font = new Font("Microsoft Sans Serif", 12); Val.Minimum = -1000000; Val.Maximum = 1000000; Val.Value = Value; Val.Font = new Font("Microsoft Sans Serif", 12); Val.Left = Name.Right; Val.Width = 80; delete.height = delete.width = 26; delete.left = Val.Right; delete.flatstyle = FlatStyle.Popup; delete.backgroundimage = Properties.Resources.cross; delete.backgroundimagelayout = ImageLayout.Center; 50

bvar.click += EditVarName; delete.click += DeleteVar; Name.Click += CalcButtonClick; Val.ValueChanged += CalcStr; bvar.parent = EditName.Parent = Name.Parent = delete.parent = Val.Parent = VP; public int index; public Button bvar; public Button Name; public TextBox EditName; public Button delete; public NumericUpDown Val; public void EditVarName(object sender, EventArgs e) Button btn = (Button)sender; if (btn.text == " ") btn.text = " "; btn.backgroundimage = Properties.Resources.save; Name.Visible = false; else btn.text = " "; btn.backgroundimage = Properties.Resources.gear; Name.Visible = true; FA.Text = FA.Text.Replace(Name.Text, EditName.Text); Name.Text = EditName.Text; public void DeleteVar(object sender, EventArgs e) Delete(); public void Delete() FA.Text = FA.Text.Replace(Name.Text, "1"); 51

for (int i = this.index + 1; i < Variables.Count; i++) Variables[i].index--; Variables[i].bVar.Top -= 30; Variables[i].Name.Top -= 30; Variables[i].EditName.Top -= 30; Variables[i].Val.Top -= 30; Variables[i].delete.Top -= 30; if (Variables[i].Name.Text == "a" + i) FA.Text = FA.Text.Replace(Variables[i].Name.Text, "a" + (i - 1)); Variables[i].Name.Text = Variables[i].EditName.Text = "a" + (i - 1); Panel VP = (Panel)((Button)delete).Parent; VP.Controls.Remove(Name); VP.Controls.Remove(EditName); VP.Controls.Remove(Val); VP.Controls.Remove(delete); VP.Controls.Remove(bVar); Variables.Remove(this); public static List<Variables> ToVars() List<Variables> vars = new List<Variables>(); for (int i = 0; i < Variables.Count; i++) Variables v = new Variables(Variables[i].Name.Text, (double)variables[i].val.value); vars.add(v); return vars; Button SaveFormula = new Button(); Button Hide = new Button(); // Button Cls = new Button(); // Button[] Num = new Button[10]; // Button[] Ops = new Button[21]; // Button Oe = new Button(); Button Val = new Button(); 52

Button Fs = new Button(); Button Back = new Button(); private static int SelectedIndex = 0; // private String CFormula = ""; private bool iso = false; private bool isval = false; // private void GenerateCalculator() // for (int i = 0; i < 10; i++) Num[i] = new Button(); for (int i = 0; i < 21; i++) Ops[i] = new Button(); // for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) // i*3+j+1 CreateCalcButton(Num[i * 3 + j], 160 + j * 50, 100 + i * 50, (i * 3 + j + 1).ToString()); // CreateCalcButton(Ops[0], 260, 250, "."); // CreateCalcButton(Num[9], 210, 250, "0"); // CreateCalcButton(Ops[1], 360, 250, "="); // Ops[1].Click -= CalcButtonClick; // Ops[1].Click += CalcStr; // CreateCalcButton(Ops[2], 310, 100, "/"); // CreateCalcButton(Ops[3], 310, 150, " "); // CreateCalcButton(Ops[4], 310, 200, "-"); // CreateCalcButton(Ops[5], 310, 250, "+"); // CreateCalcButton(Ops[6], 110, 100, "e"); // CreateCalcButton(Ops[7], 110, 150, "π"); // CreateCalcButton(Ops[8], 110, 200, "!"); // CreateCalcButton(Ops[9], 110, 250, "("); // CreateCalcButton(Ops[10], 160, 250, ")"); // CreateCalcButton(Ops[11], 60, 100, "^"); // 53

CreateCalcButton(Ops[12], 60, 150, " "); // CreateCalcButton(Ops[13], 60, 200, "ln"); // CreateCalcButton(Ops[14], 60, 250, "log"); // CreateCalcButton(Ops[15], 10, 100, "sin"); // CreateCalcButton(Ops[16], 10, 150, "cos"); // CreateCalcButton(Ops[17], 10, 200, "tg"); // CreateCalcButton(Ops[18], 10, 250, "ctg"); // for (int i = 13; i <= 18; i++) // Ops[i].Font = new Font("Consolas", 12); // CreateCalcButton(Ops[19], 360, 150, "C"); // Ops[19].Click -= CalcButtonClick; // Ops[19].Click += ClearFormulaArea; // CreateCalcButton(Ops[20], 360, 100, " "); // Ops[20].Click -= CalcButtonClick; // Ops[20].Click += RemoveCh; // CreateCalcButton(Oe, 410, 100, "O(e)"); Oe.Font = new Font("Microsoft Sans Serif", 12); Oe.Click -= CalcButtonClick; Oe.Click += OeOrVal_Click; CreateCalcButton(Val, 410, 150, "Val"); Val.Font = new Font("Microsoft Sans Serif", 12); Val.Click -= CalcButtonClick; Val.Click += OeOrVal_Click; CreateCalcButton(SaveFormula, 410, 250, "Save eq-on"); SaveFormula.Font = new Font("Microsoft Sans Serif", 9); SaveFormula.Click -= CalcButtonClick; SaveFormula.Click += FormulaToDB; CreateCalcButton(Fs, 410, 200, "Fs"); Fs.Font = new Font("Microsoft Sans Serif", 12); Fs.Click -= CalcButtonClick; Fs.Click += ShowFs; CreateCalcButton(Back, 410, 200, "Back"); Back.Font = new Font("Microsoft Sans Serif", 10); Back.Click -= CalcButtonClick; Back.Click += BackToFU; Back.Visible = false; 54

// private static void CalcButtonClick(object sender, EventArgs e) String str = ((Button)sender).Text; // ( ) switch (str) //,,,,,, // case " ": case "sin": case "cos": case "tg": case "ctg": case "e": case "ln": case "log": str += "("; break; default: break; if (SelectedIndex < 0) // SelectedIndex = 0; // if (SelectedIndex > FA.Text.Length) SelectedIndex = 0; // FA.Text = FA.Text.Substring(0, SelectedIndex) + str + FA.Text.Substring(SelectedIndex); SelectedIndex += str.length; // FA.SelectionStart = SelectedIndex; // FA.Select(); // // private static void CalcStr(object sender, EventArgs e) String res = FA.Text; // String ftext = ""; // res = Calculations.Calculate(res, out ftext, ToVars()); // FA.Text = ftext; // 55

RFA.Text = res; // private void OeOrVal_Click(object sender, EventArgs e) String str = ((Button)sender).Text; if (!iso &&!isval) CalcPanel.Width += 200; th.width += 200; Hide.Left += 200; Cls.Left += 200; GraphicsPath path = CreateRoundedRectangle(FormulaArea.Left, FormulaArea.Top - 25, base.width - 6, base.height - 6, 20); th.region = new Region(path); // else if ((iso && str == "O(e)") (str!= "O(e)" && isval)) CalcPanel.Width -= 200; th.width -= 200; Hide.Left -= 200; Cls.Left -= 200; GraphicsPath path = CreateRoundedRectangle(FormulaArea.Left, FormulaArea.Top - 25, base.width - 6, base.height - 6, 20); th.region = new Region(path); // if (str == "O(e)") if (iso) iso = isval = false; else ValsPanel.Visible = false; OePanel.Visible = true; iso = true; isval = false; else 56

if (isval) isval = iso = false; else OePanel.Visible = false; ValsPanel.Visible = true; isval = true; iso = false; // private void ClearFormulaArea(object sender, EventArgs e) FormulaArea.Text = ""; // ResultFormulaArea.Text = ""; SelectedIndex = 0; // FormulaArea.Select(); // //, private void RemoveCh(object sender, EventArgs e) SelectedIndex = FormulaArea.SelectionStart; // String str = ""; //, if (SelectedIndex > 0) // ( ) str = FormulaArea.Text.Substring(0, SelectedIndex - 1); //, FormulaArea.Text = str + FormulaArea.Text.Substring(SelectedIndex); //, SelectedIndex--; // if (SelectedIndex < 0) // ( ) SelectedIndex = 0; // 0 ( ) FormulaArea.SelectionStart = SelectedIndex; // FormulaArea.Select(); // // private void Calc() 57

// double m1 = ((double)(this.m1.value) / 10) * 0.25, m2 = ((double)(this.m2.value - 1) / 7) * 0.15, m3 = ((double)(this.m3.value) / 40) * 0.3, m4 = ((double)(this.m4.value)) * 0.2, m5 = ((double)(this.m5.value - 40) / 960) * 0.1; // Result.Text = Math.Round(m1 + m2 + m3 + m4 + m5, 2).ToString(); // ################ Ы ################ // public GraphicsPath CreateRoundedRectangle(float x, float y, float width, float height, float d) var path = new GraphicsPath(); // float r = d / 2f; // path.addline(x + r, y, x + width - r, y); // path.addarc(x + width - d, y, d, d, 270, 90); // path.addline(x + width, y + r, x + width, y + height - r); // path.addarc(x + width - d, y + height - d, d, d, 0, 90); // path.addline(x + width - r, y + height, x + r, y + height); // path.addarc(x, y + height - d, d, d, 90, 90); // path.addline(x, y + height - r, x, y + r); // path.addarc(x, y, d, d, 180, 90); // return path; // // private void CreateCalcButton(Button btn, int x, int y, String Val) btn.top = y; // btn.left = x; // btn.height = 50; // btn.width = 50; // btn.text = Val; // btn.font = new Font("Consolas", 20); // btn.flatappearance.bordersize = 0; // btn.flatstyle = FlatStyle.Flat; // btn.parent = CalcPanel; // - btn.click += CalcButtonClick; // 58

GraphicsPath path2 = CreateRoundedRectangle(0, 1, btn.width - 1, btn.height - 1, 20); // btn.region = new Region(path2); // btn.backcolor = Color.FromArgb(150, Color.LightGray); // Label iconlabel = new Label(); // Label Label headtext = new Label(); // // private void Calculator_MouseDown(object sender, MouseEventArgs e) Capture = false; // iconlabel.capture = false; // headtext.capture = false; // Message m = Message.Create(base.Handle, 0xa1, new IntPtr(2), IntPtr.Zero); // ( ) base.wndproc(ref m); // Windows // private void CreateHeader() // // GraphicsPath path = CreateRoundedRectangle(this.Left + 3, this.top + 3, this.width - 6, this.height - 6, 20); this.region = new Region(path); // // Cls.Top = this.top; // Cls.Left = this.right - 35; // Cls.Height = 30; // Cls.Width = 33; // Cls.Text = "X"; // Cls.Font = new Font(Cls.Font, FontStyle.Bold); // Cls.FlatAppearance.BorderSize = 0; // Cls.FlatStyle = FlatStyle.Flat; // // Cls.BackColor = Color.DarkGray; // Cls.MouseEnter += (s, e) => Cls.BackColor = Color.Red; // 59

; Cls.MouseLeave += (s, e) => Cls.BackColor = Color.DarkGray; // ; Cls.Parent = this; // - Cls.Click += Cls_Click; // // Hide.Top = this.top; // Hide.Left = this.right - 65; // Hide.Height = 30; // Hide.Width = 30; // Hide.Text = " "; // Hide.Font = new Font(Hide.Font, FontStyle.Bold); // Hide.FlatAppearance.BorderSize = 0; // Hide.FlatStyle = FlatStyle.Flat; // Hide.BackColor = Color.DarkGray; // Hide.Parent = this; // - Hide.Click += Hide_Click; // Icon icon = new Icon("HeadIcon.ico", 20, 20); // iconlabel.image = icon.tobitmap(); // ( ) iconlabel.size = new Size(20, 20); // iconlabel.top = this.top + 5; // iconlabel.left = this.left + 5; // iconlabel.parent = this; // - iconlabel.mousedown += Calculator_MouseDown; // headtext.size = new Size(200, 20); // headtext.top = this.top + 5; // headtext.left = iconlabel.right + 5; // headtext.font = new Font("Constantia", 12, FontStyle.Italic); // headtext.text = " "; // headtext.parent = this; // - headtext.mousedown += Calculator_MouseDown; // // private void Hide_Click(object sender, EventArgs e) 60

// this.windowstate = FormWindowState.Minimized; // private void Cls_Click(object sender, EventArgs e) this.close(); // private void Help_Click(object sender, EventArgs e) Help help = new Help(); help.owner = this; this.visible = false; help.show(); help.top = this.top + 20; help.left = this.left + 70; // private void FormulaArea_Leave(object sender, EventArgs e) // SelectedIndex = FormulaArea.SelectionStart; private void m_valuechanged(object sender, EventArgs e) Calc(); private void Clear_Click(object sender, EventArgs e) m1.value = m1.minimum; m2.value = m2.minimum; m3.value = m3.minimum; m4.value = m4.minimum; m5.value = m5.minimum; private void button1_click(object sender, EventArgs e) 61

0); Variable var = new Variable((Panel)((Button)sender).Parent, Variables.Count, Variables.Add(var); public void EditVarName(object sender, EventArgs e) Button btn = (Button)sender; if (btn.text == " ") btn.text = "s"; Variables[0].Name.Visible = false; else btn.text = " "; Variables[0].Name.Visible = true; public void FormulaToDB(object sender, EventArgs e) Enabled = false; if (FA.Text == "") return; String ftext = ""; FormulaContext fs = new FormulaContext(); fs.database.connection.connectionstring = ConfigurationManager.ConnectionStrings["FormulasDB"].ConnectionString; Formula f = new Formula(); if (EditFormulaID == -1) f.result = double.parse(calculations.calculate(fa.text, out ftext, ToVars())); else f = fs.formulas.firstordefault(x => x.formulaid == EditFormulaID); var variables = fs.vars.where(x => x.formula.formulaid == EditFormulaID); 62

foreach (var variable in variables) fs.entry(variable).state = EntityState.Deleted; f.equation = FA.Text; fs.savechanges(); f.vars = new List<Var>(); for (int i = 0; i < Variables.Count; i++) Var v = new Var(); v.name = Variables[i].Name.Text; v.value = (double)variables[i].val.value; f.vars.add(v); fs.formulas.addorupdate(f); fs.savechanges(); if (EditFormulaID == -1) MessageBox.Show(" \"" + FA.Text + "\" "); else MessageBox.Show(" \"" + FA.Text + "\" "); Enabled = true; if (EditFormulaID!= -1) fu.setsf(f); rback(); private FormulaUse fu; public void ShowFs(object sender, EventArgs e) this.enabled = false; fu = new FormulaUse(); fu.owner = this; fu.show(); fu.top = Top + 10; fu.left = Left + 10; this.enabled = true; 63

this.visible = false; public void BackToFU(object sender, EventArgs e) rback(); public void rback() Back.Visible = false; this.visible = false; fu.visible = true; SaveFormula.Text = "Save eq-on"; SaveFormula.Font = new Font("Microsoft Sans Serif", 9); Fs.Visible = true; for (int i = Variables.Count - 1; i >= 0; i--) Variables[i].Delete(); FA.Text = ""; RFA.Text = ""; private void ChangeServDB_Click(object sender, EventArgs e) string servname; using (var form = new ChangeServDB()) form.showdialog(); servname = form.servername; // var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); var connectionstringssection = (ConnectionStringsSection)config.GetSection("connectionStrings"); connectionstringssection.connectionstrings["formulasdb"].connectionstring = "Data Source =" + servname + ";Initial Catalog=FormulasDB;Integrated Security=True;MultipleActiveResultSets=True"; config.save(); ConfigurationManager.RefreshSection("connectionStrings"); 64

private void Calculator_VisibleChanged(object sender, EventArgs e) Formula f = new Formula(); if (fu!= null) f = fu.getsfid(); if (f!= null) EditFormulaID = f.formulaid; else EditFormulaID = -1; if (EditFormulaID!= -1 && SaveFormula.Text!= "Update") Back.Visible = true; SaveFormula.Text = "Update"; SaveFormula.Font = new Font("Microsoft Sans Serif", 8); Fs.Visible = false; FA.Text = f.equation; RFA.Text = f.result.tostring(); for (int i = Variables.Count-1; i >= 0; i--) Variables[i].Delete(); for (int i = 0; i < f.vars.count; i++) Variable v = new Variable(ValsPanel, i, (decimal)f.vars[i].value); v.name.text = v.editname.text = f.vars[i].name; Variables.Add(v); private void ToolStripMenuItem_Click(object sender, EventArgs e) Close(); FormulaUse.cs using System; using System.Collections.Generic; using System.Configuration; using System.Data.Entity; 65

using System.Drawing; using System.Linq; using System.Windows.Forms; namespace Dipl public partial class FormulaUse : Form Label bufs = new Label(); List<Formula> frs = new List<Formula>(); List<Label> VarsName = new List<Label>(); List<NumericUpDown> VarsValue = new List<NumericUpDown>(); public Formula selformula = null; public FormulaUse() InitializeComponent(); bufs.autosize = true; bufs.parent = VarsPanel; bufs.visible = false; bufs.font = new Font("Book Antiqua", 12, FontStyle.Italic); private void showdata() using (FormulaContext fs = new FormulaContext()) fs.database.connection.connectionstring = ConfigurationManager.ConnectionStrings["FormulasDB"].ConnectionString; fs.database.initialize(false); if (fs.database.exists()) var query = fs.formulas.join(fs.vars, f => f.formulaid, v => v.formula.formulaid, (f, v) => new f, v ).GroupBy(f => f.f); if (query!= null) foreach (var fr in query) frs.add(fr.key); Formulas.Items.Add(fr.Key.Equation); 66

Formulas.ItemHeight = 200; else MessageBox.Show(@" "); private void Formulas_SelectedIndexChanged(object sender, EventArgs e) if (Formulas.SelectedIndex!= -1) GenVars(Formulas.SelectedIndex); Result.Text = frs[formulas.selectedindex].result.tostring(); private void FormulaUse_FormClosed(object sender, FormClosedEventArgs e) Owner.Visible = true; private void Formulas_MeasureItem(object sender, MeasureItemEventArgs e) bufs.text = Formulas.Items[e.Index].ToString(); if (bufs.width > 240) e.itemheight = (bufs.width / 240) * 40; else e.itemheight = 20; private void Formulas_DrawItem(object sender, DrawItemEventArgs e) if (e.index >= 0) e.drawbackground(); Graphics g = e.graphics; if ((e.state & DrawItemState.Selected) == DrawItemState.Selected) g.fillrectangle(new SolidBrush(Color.DodgerBlue), e.bounds); else if (e.index % 2 == 0) g.fillrectangle(new SolidBrush(Color.LightGray), e.bounds); else g.fillrectangle(new SolidBrush(Color.WhiteSmoke), e.bounds); e.drawfocusrectangle(); e.graphics.drawstring(formulas.items[e.index].tostring(), e.font, new SolidBrush(e.ForeColor), e.bounds); 67

private void GenVars(int index) foreach (Label label in VarsName) VarsPanel.Controls.Remove(label); label.dispose(); foreach (NumericUpDown numericupdown in VarsValue) VarsPanel.Controls.Remove(numericUpDown); numericupdown.dispose(); for (int i = 0; i < frs[index].vars.count; i++) Label name = new Label(); NumericUpDown value = new NumericUpDown(); value.minimum = -1000000; value.maximum = 1000000; name.font = value.font = new Font("Microsoft Sans Serif", 12); name.parent = value.parent = VarsPanel; name.width = 70; value.width = 90; name.textalign = ContentAlignment.MiddleCenter; name.left = 2; value.left = name.right + 1; name.top = value.top = 2 + i * 30; name.text = frs[index].vars[i].name; value.value = decimal.parse(frs[index].vars[i].value.tostring()); value.valuechanged += EditValue; VarsName.Add(name); VarsValue.Add(value); public void EditValue(object sender, EventArgs e) List<Variables> vars = new List<Variables>(); for (int i = 0; i < VarsValue.Count; i++) Variables v = new Variables(VarsName[i].Text, (double)varsvalue[i].value); vars.add(v); 68

Result.Text = Calculations.Calculate(frs[Formulas.SelectedIndex].Equation, out String res, vars); private void FormulaUse_Shown(object sender, EventArgs e) showdata(); Loading.Visible = false; private void RemoveFormula_Click(object sender, EventArgs e) if (Formulas.SelectedIndex < 0) return; using (FormulaContext fs = new FormulaContext()) int id = frs[formulas.selectedindex].formulaid; var formula = fs.formulas.firstordefault(x => x.formulaid == id); fs.entry(formula).state = EntityState.Deleted; var variables = fs.vars.where(x => x.formula.formulaid == id); foreach (var variable in variables) fs.entry(variable).state = EntityState.Deleted; fs.savechanges(); foreach (Label label in VarsName) VarsPanel.Controls.Remove(label); label.dispose(); foreach (NumericUpDown numericupdown in VarsValue) VarsPanel.Controls.Remove(numericUpDown); numericupdown.dispose(); Formulas.Items.Remove(Formulas.SelectedItem); Result.Text = ""; private void Edit_Click(object sender, EventArgs e) if (Formulas.SelectedIndex >= 0) selformula = frs[formulas.selectedindex]; 69

this.visible = false; Owner.Visible = true; public Formula GetSFID() return selformula; public void SetSF(Formula f) selformula = f; private void FormulaUse_VisibleChanged(object sender, EventArgs e) if (Visible) if (selformula!= null) frs[formulas.selectedindex] = selformula; Formulas.SelectedItem = selformula.equation; selformula = null; ChangeServDB.cs using System; using System.Collections.Generic; using System.Data; using System.Windows.Forms; namespace Dipl public partial class ChangeServDB : Form public string ServerName get; set; List<string> servs = new List<string>(); 70

public ChangeServDB() InitializeComponent(); // System.Data.Sql.SqlDataSourceEnumerator instance = System.Data.Sql.SqlDataSourceEnumerator.Instance; DataTable datatable = instance.getdatasources(); foreach (System.Data.DataRow row in datatable.rows) ServName.Items.Add(row[0].ToString() + "\\" + row[1].tostring()); servs.add(row[1].tostring()); if (ServName.Items.Count > 0) ServName.SelectedIndex = 0; private void Apply_Click(object sender, EventArgs e) ServerName = ServName.Text; this.close(); Help.cs using System; using System.Windows.Forms; namespace Dipl public partial class Help : Form public Help() InitializeComponent(); private void Help_FormClosed(object sender, FormClosedEventArgs e) Owner.Visible = true; private void Oe_Click(object sender, EventArgs e) 71

MainHelp.Visible = false; Oe.Visible = false; Val.Visible = false; SaveEq.Visible = false; Fs.Visible = false; OeButtonHelp.Visible = true; OeFormula.Visible = true; Back.Visible = true; private void Back_Click(object sender, EventArgs e) MainHelp.Visible = true; Oe.Visible = true; Val.Visible = true; SaveEq.Visible = true; Fs.Visible = true; OeButtonHelp.Visible = false; OeFormula.Visible = false; ValButtonHelp.Visible = false; SaveEqButtonHelp.Visible = false; FsButtonHelp.Visible = false; Back.Visible = false; private void Val_Click(object sender, EventArgs e) MainHelp.Visible = false; Oe.Visible = false; Val.Visible = false; SaveEq.Visible = false; Fs.Visible = false; ValButtonHelp.Visible = true; Back.Visible = true; private void SaveEq_Click(object sender, EventArgs e) MainHelp.Visible = false; Oe.Visible = false; Val.Visible = false; SaveEq.Visible = false; Fs.Visible = false; 72

SaveEqButtonHelp.Visible = true; Back.Visible = true; private void Fs_Click(object sender, EventArgs e) MainHelp.Visible = false; Oe.Visible = false; Val.Visible = false; SaveEq.Visible = false; Fs.Visible = false; FsButtonHelp.Visible = true; Back.Visible = true; Calculations.cs using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace Dipl public class Calculations private static List<Variables> Variables; public static String Calculate(String res, out String ftext, List<Variables> vars) Variables = vars; res = res.replace(" ", ""); // res = res.replace('*', ' '); // res = res.tolower(); // res = res.replace("sqrt", " "); // sqrt res = res.replace("pi", "π"); // pi if (res == "") ftext = res; return res; 73

ftext = res; // int lb = res.tochararray().where(i => i == '(').Count(); // int rb = res.tochararray().where(i => i == ')').Count(); // if (lb > rb) // MessageBox.Show(", "); // if (lb < rb) // MessageBox.Show(", "); // if (lb!= rb) // return ""; // Token tk = new Token(); // tk.lec = res; // GetToken(tk); // res = CalcToken(tk).ToString(); // return res; // private static void GetToken(Token tk) Token ltk = new Token(); // ( ) Token rtk = new Token(); // ( ) ltk.parent = rtk.parent = tk; // ltk.action = rtk.action = ""; // tk.left = ltk; // tk.right = rtk; // int lb = 0, rb = 0; // // + - for (int i = 0; i < tk.lec.length; i++) if (tk.lec[i] == '(') // lb++; // else if (tk.lec[i] == ')') // rb++; // else // '+' '-' if (lb == rb && i!= 0 && (tk.lec[i] == '+' tk.lec[i] == '-')) tk.action = tk.lec[i].tostring(); // 74

tk.left.lec = OpenBr(tk.lec.Substring(0, i)); // ( ) tk.right.lec = OpenBr(tk.lec.Substring(i + 1)); // ( ) GetToken(tk.left); // GetToken(tk.right); // return; // // * / for (int i = 0; i < tk.lec.length; i++) if (tk.lec[i] == '(') // lb++; // else if (tk.lec[i] == ')') // rb++; // else // ' ' '/' if (lb == rb && (tk.lec[i] == ' ' tk.lec[i] == '/')) tk.action = tk.lec[i].tostring(); // tk.left.lec = OpenBr(tk.lec.Substring(0, i)); // ( ) tk.right.lec = OpenBr(tk.lec.Substring(i + 1)); // ( ) GetToken(tk.left); // GetToken(tk.right); // return; // // ^ for (int i = 0; i < tk.lec.length; i++) if (tk.lec[i] == '(') // lb++; // else if (tk.lec[i] == ')') // rb++; // else 75

// '^' if (lb == rb && (tk.lec[i] == '^')) tk.action = tk.lec[i].tostring(); // tk.left.lec = OpenBr(tk.lec.Substring(0, i)); // ( ) tk.right.lec = OpenBr(tk.lec.Substring(i + 1)); // ( ) GetToken(tk.left); // GetToken(tk.right); // return; // // e ln log sin cos tg ctg! for (int i = 0; i < tk.lec.length; i++) if (tk.lec[i] == '(') // lb++; // else if (tk.lec[i] == ')') // rb++; // else // if (lb == rb) // 'e' ' ' if (tk.lec[i] == 'e' tk.lec[i] == ' ') tk.action = tk.lec[i].tostring(); // tk.left.lec = ""; // ( ) tk.right.lec = OpenBr(tk.lec.Substring(i + 1)); // ( ) GetToken(tk.right); // return; // // "ln" "tg" else if (i + 1 < tk.lec.length && ((tk.lec[i] == 'l' && tk.lec[i + 1] == 'n') (tk.lec[i] == 't' && tk.lec[i+1] == 'g'))) tk.action = tk.lec.substring(i, 2); // 76

tk.left.lec = ""; // ( ) tk.right.lec = OpenBr(tk.lec.Substring(i + 2)); // ( ) GetToken(tk.right); // return; // // "log", "sin", "cos" "ctg" else if (i + 2 < tk.lec.length && ((tk.lec[i] == 'l' && tk.lec[i + 1] == 'o' && tk.lec[i + 2] == 'g') (tk.lec[i] == 's' && tk.lec[i + 1] == 'i' && tk.lec[i + 2] == 'n') (tk.lec[i] == 'c' && tk.lec[i + 1] == 'o' && tk.lec[i + 2] == 's') (tk.lec[i] == 'c' && tk.lec[i + 1] == 't' && tk.lec[i + 2] == 'g'))) tk.action = tk.lec.substring(i, 3); // tk.left.lec = ""; // ( ) tk.right.lec = OpenBr(tk.lec.Substring(i + 3)); // ( ) GetToken(tk.right); // return; // // '!' else if (tk.lec[i] == '!') tk.action = tk.lec[i].tostring(); // tk.left.lec = ""; // ( ) tk.right.lec = OpenBr(tk.lec.Substring(0, i)); // ( ) GetToken(tk.right); // return; // if (tk.lec == "π") // - tk.lec = Math.PI.ToString(); // // private static double CalcToken(Token tk) double res = 0; // //, switch (tk.action) // 77

case "+": // res = CalcToken(tk.left) + CalcToken(tk.right); break; case "-": // res = CalcToken(tk.left) - CalcToken(tk.right); break; case " ": // res = CalcToken(tk.left) * CalcToken(tk.right); break; case "/": // res = CalcToken(tk.left) / CalcToken(tk.right); break; case "^": // res = Math.Pow(CalcToken(tk.left), CalcToken(tk.right)); break; case " ": // res = Math.Sqrt(CalcToken(tk.right)); break; case "e": // res = Math.Exp(CalcToken(tk.right)); break; case "ln": // res = Math.Log(CalcToken(tk.right)); break; case "log": // res = Math.Log10(CalcToken(tk.right)); break; case "sin": // res = Math.Sin(CalcToken(tk.right)); break; case "cos": // res = Math.Cos(CalcToken(tk.right)); break; case "tg": // res = Math.Tan(CalcToken(tk.right)); break; case "ctg": // res = 1 / Math.Tan(CalcToken(tk.right)); break; case "!": // double val = CalcToken(tk.right); res = 1; for (int i = 2; i <= val; i++) 78

res *= i; break; default: // foreach (Variables v in Variables) if (tk.lec == v.name) tk.lec = v.value.tostring(); bool test = double.tryparse(tk.lec, out res); // if (!test) // // MessageBox.Show(". \"" + tk.lec + "\" "); res = Double.NaN; // - break; return res; // //, private static string OpenBr(String str) if (str.length == 0) // return ""; // int br = 0; // if (str[0] == '(') // br++; // for (int i = 1; i < str.length; i++) // if (str[i] == '(') // - br++; // else if (str[i] == ')') // - br--; // if (br == 0) // ( ) if (i == str.length - 1) // 79

str = OpenBr(str.Substring(1, str.length - 2)); // else break; // return str; // Formula.cs using System.Collections.Generic; namespace Dipl public class Formula public int FormulaId get; set; public string Equation get; set; public double Result get; set; // public List<Var> Vars get; set; Var.cs namespace Dipl public class Var public int VarId get; set; public string name get; set; public double value get; set; // public Formula Formula get; set; Variables.cs 80

namespace Dipl public class Variables public Variables(string n, double v) Value = v; Name = n; public double Value get; set; public string Name get; set; Token.cs using System; namespace Dipl // public class Token public String action; // ( ) public String lec; // public Token parent; // public Token left; // ( ) public Token right; // ( ) FormulaContext.cs using System.Data.Entity; namespace Dipl public class FormulaContext : DbContext public FormulaContext() : base("formulasdb") // EF,, // 81

Database.SetInitializer( new DropCreateDatabaseIfModelChanges<FormulaContext>()); public DbSet<Formula> Formulas get; set; public DbSet<Var> Vars get; set; app.config <?xml version="1.0" encoding="utf-8"?> <configuration> <configsections> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?linkid=237468 --> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirepermission="false" /> </configsections> <startup> <supportedruntime version="v4.0" sku=".netframework,version=v4.6" /> </startup> <entityframework> <defaultconnectionfactory type="system.data.entity.infrastructure.sqlconnectionfactory, EntityFramework" /> <providers> <provider invariantname="system.data.sqlclient" type="system.data.entity.sqlserver.sqlproviderservices, EntityFramework.SqlServer" /> </providers> </entityframework> <connectionstrings> <add name="formulasdb" connectionstring="data Source=.;Initial Catalog=FormulasDB;Integrated Security=True;MultipleActiveResultSets=True" providername="system.data.sqlclient" /> </connectionstrings> </configuration> 82

.1 1.2 2 83

.3 3.4 4 84

.5 5.6 6 85

.7 7.8 8 86

.9 9.10 10 87

.11 11.12 12 88

.13 13.14 14 89

.15 15 90