Beispiel #1
0
 protected void OnSaveReceiptActionActivated(object sender, System.EventArgs e)
 {
     if (ReceiptsManager.DetermineReceiptType(mStage.StageFileName, mStage.RawFileName) == ReceiptsManager.ReceiptType.Default ||
         ReceiptsManager.DetermineReceiptType(mStage.StageFileName, mStage.RawFileName) == ReceiptsManager.ReceiptType.Custom)
     {
         mStage.SaveStage();
     }
     else
     {
         mStage.SaveStage(ReceiptsManager.MakeDefaultOrCustomReceiptFilename(mStage.RawFileName, null));
     }
     //mStage.StageFileName
 }
Beispiel #2
0
    protected void OnSaveReceiptAsActionActivated(object sender, System.EventArgs e)
    {
        ReceiptSaveDialog rsd = new ReceiptSaveDialog(this, mStage.RawFileName);

        if (ReceiptsManager.DetermineReceiptType(mStage.StageFileName, mStage.RawFileName) == ReceiptsManager.ReceiptType.Custom)
        {
            rsd.SelectedType = ReceiptSaveDialog.ReceiptType.Custom;
        }
        else if (ReceiptsManager.DetermineReceiptType(mStage.StageFileName, mStage.RawFileName) == ReceiptsManager.ReceiptType.Class)
        {
            rsd.SelectedType = ReceiptSaveDialog.ReceiptType.Class;
        }
        else
        {
            rsd.SelectedType = ReceiptSaveDialog.ReceiptType.Default;
        }

        rsd.SelectedName = ReceiptsManager.ExtractReceiptName(mStage.StageFileName, mStage.RawFileName);

        if (rsd.Run() == (int)Gtk.ResponseType.Accept)
        {
            if (rsd.SelectedType == ReceiptSaveDialog.ReceiptType.Default)
            {
                mStage.SaveStage(ReceiptsManager.MakeDefaultOrCustomReceiptFilename(mStage.RawFileName, null));
            }
            else if (rsd.SelectedType == ReceiptSaveDialog.ReceiptType.Custom)
            {
                mStage.SaveStage(ReceiptsManager.MakeDefaultOrCustomReceiptFilename(mStage.RawFileName, rsd.SelectedName));
            }
            else if (rsd.SelectedType == ReceiptSaveDialog.ReceiptType.Class)
            {
                mStage.SaveStage(ReceiptsManager.MakeClassReceiptFilename(System.IO.Path.GetDirectoryName(mStage.RawFileName), rsd.SelectedName));
            }
            else
            {
                throw new Exception("Invalid rsd.SelectedType value");
            }
        }
        rsd.Destroy();
    }