Beispiel #1
0
        /// <summary>
        /// 初期化周り
        /// </summary>
        private void MainInit()
        {
            var root = Util.root;

            if (!Directory.Exists(root + "/system"))
            {
                Directory.CreateDirectory(root + "/system");
            }
            if (!Directory.Exists(root + "/data"))
            {
                Directory.CreateDirectory(root + "/data");
            }

            var bundle = Path.Combine(NSBundle.MainBundle.BundlePath, "Contents", "Resources", "system");

            if (!File.Exists(root + "/system/config.csm"))
            {
                File.Copy(bundle + "/config.csm", root + "/system/config.csm");
            }

            for (int i = 0; i < 10; i++)
            {
                if (!File.Exists(root + "/system/setting" + i.ToString() + ".csm"))
                {
                    File.Copy(bundle + "/setting" + i.ToString() + ".csm", root + "/system/setting" + i.ToString() + ".csm");
                }
            }

            if (!File.Exists(root + "/system/addr.csv"))
            {
                File.Copy(bundle + "/addr.csv", root + "/system/addr.csv");
            }

            config   = ConfigFromXml.GetConfigFromXml(root + "/system/config.csm");
            settings = new SettingData[10];
            for (int i = 0; i < 10; i++)
            {
                settings[i]       = SettingFromXml.GetSettingFromXml(root + "/system/setting" + i.ToString() + ".csm", i);
                settings[i].bands = 1;
            }
            CommonInstance.getInstance().config              = config;
            CommonInstance.getInstance().settings            = settings;
            CommonInstance.getInstance().currentSetting      = settings[0];
            CommonInstance.getInstance().currentSettingIndex = 0;

            ReSetSettingMenu();

            calc         = new AstroCalc();
            ringsData[0] = ringsData[1] = ringsData[2] = ringsData[3] = ringsData[4] = ringsData[5] = ringsData[6] =
                calc.ReCalc(config, settings[0], new UserData());

            //            Console.WriteLine(config.defaultPlace);

            // aspect calc
            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    aspectsData[i, j] = new List <AspectInfo>();
                }
            }
            aspect = new AspectCalc();
            foreach (int i in Enumerable.Range(0, 4))
            {
                aspectsData[i, i] = aspect.AspectCalcSame(ringsData[i].planetData, i);
            }

            int ringIndexFrom = 0;
            int ringIndexTo   = 0;

            for (ringIndexFrom = 0; ringIndexFrom < 5; ringIndexFrom++)
            {
                for (ringIndexTo = 0; ringIndexTo < 5; ringIndexTo++)
                {
                    if (ringIndexFrom == ringIndexTo)
                    {
                        continue;
                    }
                    aspectsData[ringIndexFrom, ringIndexTo] =
                        aspect.AspectCalcOther(ringsData[ringIndexFrom].planetData,
                                               ringsData[ringIndexTo].planetData,
                                               ringIndexFrom,
                                               ringIndexTo);
                }
            }

            ReSetUserBox();

            // cuspList
            CuspListDataSource CDataSource = new CuspListDataSource();

            for (int i = 1; i <= 12; i++)
            {
                CDataSource.list.Add(new CuspListData()
                {
                    Degree1 = ringsData[0].cusps[i],
                    Degree2 = ringsData[1].cusps[i],
                    Degree3 = ringsData[2].cusps[i]
                });
            }

            CuspList.DataSource = CDataSource;
            CuspList.Delegate   = new CuspListDelegate(CDataSource);


/*
 *          SKCanvasView sk = new SKCanvasView(new CGRect(0, 0, 690, 720));
 *          sk.PaintSurface += CanvasPaint;
 *          horoscopeCanvas.AddSubview(sk);
 */

            // time setter
            DateSetterDatePicker.DateValue = new NSDate();
            DateSetterCombo.SelectItem(0);

            ReRender();
        }
        void ReleaseDesignerOutlets()
        {
            if (canvas != null)
            {
                canvas.Dispose();
                canvas = null;
            }

            if (ChartBox != null)
            {
                ChartBox.Dispose();
                ChartBox = null;
            }

            if (ChartBoxView != null)
            {
                ChartBoxView.Dispose();
                ChartBoxView = null;
            }

            if (CuspList != null)
            {
                CuspList.Dispose();
                CuspList = null;
            }

            if (DateSetterCombo != null)
            {
                DateSetterCombo.Dispose();
                DateSetterCombo = null;
            }

            if (DateSetterCurrentLat != null)
            {
                DateSetterCurrentLat.Dispose();
                DateSetterCurrentLat = null;
            }

            if (DateSetterCurrentLng != null)
            {
                DateSetterCurrentLng.Dispose();
                DateSetterCurrentLng = null;
            }

            if (DateSetterDatePicker != null)
            {
                DateSetterDatePicker.Dispose();
                DateSetterDatePicker = null;
            }

            if (DateSetterDay != null)
            {
                DateSetterDay.Dispose();
                DateSetterDay = null;
            }

            if (DateSetterHour != null)
            {
                DateSetterHour.Dispose();
                DateSetterHour = null;
            }

            if (DateSetterMinute != null)
            {
                DateSetterMinute.Dispose();
                DateSetterMinute = null;
            }

            if (DateSetterSecond != null)
            {
                DateSetterSecond.Dispose();
                DateSetterSecond = null;
            }

            if (Event1Date != null)
            {
                Event1Date.Dispose();
                Event1Date = null;
            }

            if (Event1Name != null)
            {
                Event1Name.Dispose();
                Event1Name = null;
            }

            if (Event2Date != null)
            {
                Event2Date.Dispose();
                Event2Date = null;
            }

            if (Event2Name != null)
            {
                Event2Name.Dispose();
                Event2Name = null;
            }

            if (horoscopeCanvas != null)
            {
                horoscopeCanvas.Dispose();
                horoscopeCanvas = null;
            }

            if (img != null)
            {
                img.Dispose();
                img = null;
            }

            if (testButton != null)
            {
                testButton.Dispose();
                testButton = null;
            }

            if (User1Date != null)
            {
                User1Date.Dispose();
                User1Date = null;
            }

            if (User1Name != null)
            {
                User1Name.Dispose();
                User1Name = null;
            }

            if (User2Date != null)
            {
                User2Date.Dispose();
                User2Date = null;
            }

            if (User2Name != null)
            {
                User2Name.Dispose();
                User2Name = null;
            }

            if (userDbDateColumn != null)
            {
                userDbDateColumn.Dispose();
                userDbDateColumn = null;
            }

            if (userDbNameColumn != null)
            {
                userDbNameColumn.Dispose();
                userDbNameColumn = null;
            }

            if (web != null)
            {
                web.Dispose();
                web = null;
            }

            if (settingMenu != null)
            {
                settingMenu.Dispose();
                settingMenu = null;
            }
        }