コード例 #1
0
		private void OnDocumentCreated(Document document)
		{
			if (DocumentCreated != null)
				DocumentCreated(this, null);

			Document.BackgroundRun(0, 0);
		}
コード例 #2
0
		internal static void Load(Document document)
		{
			// Load the income packages
			foreach (Income income in m_IncomePackages)
			{
				Income newIncome = new Income(income);
				document.Incomes.Add(newIncome);
			}

			// Load the spending packages
			foreach (Package package in m_SpendingPackages)
			{
				Package newPackage = new Package(package);
				document.Packages.Add(newPackage);
			}
		}
コード例 #3
0
		internal void Close()
		{
			Document = new Document();
		}
コード例 #4
0
		internal bool Open(object obj)
		{
			Document document = null;
			string fileName = (obj as string);
			if (obj is FileInfoHelper || (fileName != null && fileName != "Sample"))
			{
				document = Document.Open(obj);
			}
			else
			{
				document = new Document();

				// Load the default account list
				foreach (Account account in Account.DefaultList)
				{
					Account newAccount = new Account(account.Name, account.AccountType, account.AllowNegative, account.Hidden, account.Internal);
					document.Accounts.Add(newAccount);
				}

				if (fileName == "Sample")
				{
					DebugDocumentData.Load(document);
					fileName = null;
				}
			}

			if (document == null)
				return false;

			if (fileName != ResxResources.DefaultDocumentFileName)
			{
				if (obj is FileInfoHelper)
					_CurrentDocumentFileName = (obj as FileInfoHelper).Name;
				else
				if (fileName != null)
					_CurrentDocumentFileName = fileName;
				else
					_CurrentDocumentFileName = ResxResources.UntitledDocumentFileName;
				Settings.Write<string>("MostRecentDocumentFileName", _CurrentDocumentFileName);
			}

			Document = document;
			return true;
		}