forked from sureshdr/mhora
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dasa3Parts.cs
187 lines (159 loc) · 5.16 KB
/
Dasa3Parts.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/******
Copyright (C) 2005 Ajit Krishnan (http://www.mudgala.com)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace mhora
{
/// <summary>
/// Summary description for Dasa3Parts.
/// </summary>
public class Dasa3Parts : System.Windows.Forms.Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
ToDate td = null;
DasaEntry de = null;
Horoscope h = null;
private System.Windows.Forms.ListView mList;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.Label txtDesc;
public Dasa3Parts(Horoscope _h, DasaEntry _de, ToDate _td)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
td = _td;
de = _de;
h = _h;
this.repopulate();
}
private void populateDescription ()
{
sweph.obtainLock(h);
Moment start = td.AddYears(de.startUT);
Moment end = td.AddYears(de.startUT + de.DasaLength);
sweph.releaseLock(h);
ZodiacHouse zh = new ZodiacHouse(de.ZHouse);
if ((int)de.ZHouse != 0)
this.txtDesc.Text = string.Format ("{0} - {1} to {2}", zh, start, end);
else
this.txtDesc.Text = string.Format ("{0} - {1} to {2}", de.graha, start, end);
}
private void repopulate ()
{
this.populateDescription();
double partLength = de.DasaLength / 3.0;
sweph.obtainLock(h);
ArrayList alParts = new ArrayList();
for (int i=0; i<4; i++)
{
Moment m = td.AddYears(de.startUT + partLength * i);
alParts.Add(m);
}
Moment[] momentParts = (Moment[])alParts.ToArray(typeof(Moment));
sweph.releaseLock(h);
for (int i=1; i< momentParts.Length; i++)
{
string fmt = string.Format
("Equal Part {0} - {1} to {2}",
i, momentParts[i-1], momentParts[i]);
this.mList.Items.Add (fmt);
}
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.txtDesc = new System.Windows.Forms.Label();
this.mList = new System.Windows.Forms.ListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.SuspendLayout();
//
// txtDesc
//
this.txtDesc.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtDesc.Location = new System.Drawing.Point(8, 8);
this.txtDesc.Name = "txtDesc";
this.txtDesc.Size = new System.Drawing.Size(472, 23);
this.txtDesc.TabIndex = 0;
this.txtDesc.Text = "txtDesc";
this.txtDesc.Click += new System.EventHandler(this.label1_Click);
//
// mList
//
this.mList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.mList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1});
this.mList.FullRowSelect = true;
this.mList.Location = new System.Drawing.Point(8, 40);
this.mList.Name = "mList";
this.mList.Size = new System.Drawing.Size(472, 272);
this.mList.TabIndex = 1;
this.mList.View = System.Windows.Forms.View.Details;
this.mList.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
//
// columnHeader1
//
this.columnHeader1.Width = 1000;
//
// Dasa3Parts
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(488, 318);
this.Controls.Add(this.mList);
this.Controls.Add(this.txtDesc);
this.Name = "Dasa3Parts";
this.Text = "Dasa 3 Parts Reckoner";
this.Load += new System.EventHandler(this.Dasa3Parts_Load);
this.ResumeLayout(false);
}
#endregion
private void Dasa3Parts_Load(object sender, System.EventArgs e)
{
}
private void label1_Click(object sender, System.EventArgs e)
{
}
private void listView1_SelectedIndexChanged(object sender, System.EventArgs e)
{
}
}
}