コード例 #1
0
        private void Button_Select_Click(object sender, RoutedEventArgs e)
        {
            fileSelected = Selection_File.GetSelection().selectionText + fileExtension;

            // If the network is new the dictionary of the network is not found in the config
            // so we generate default path
            string path;

            path = Config.Instance[Config.Keys.Subjects][subject][algorithm][pathKey];


            string absPath = System.IO.Path.GetFullPath(path);

            switch (selectSource)
            {
            case SelectSource.Processed:
                result = EndSelectionForNew(absPath, fileSelected);
                break;
            }

            if (result == SelectResult.Cancel)
            {
                return;
            }
            else
            {
                Close();
            }
        }
コード例 #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// \fn private void Button_Select_Click(object sender, RoutedEventArgs e)
        ///
        /// \brief Event handler. Called by Button_Select for click events.
        ///
        /// \par Description.
        ///      -  This method gets the results from the controls and
        ///         -   According to the SelectSource call a method to determine on the action to perform
        ///         -   According to the action to perform determine:
        ///             -   If to update the config
        ///             -   If to exit or continue with the dialog
        ///
        /// \par Algorithm.
        ///
        /// \par Usage Notes.
        ///
        /// \author Ilanh
        /// \date 29/08/2017
        ///
        /// \param sender  (object) - Source of the event.
        /// \param e       (RoutedEventArgs) - Routed event information.
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        private void Button_Select_Click(object sender, RoutedEventArgs e)
        {
            string subject   = Selection_Subject.GetSelection().selectionText;
            string algorithm = Selection_Algorithm.GetSelection().selectionText;
            string network   = Selection_Network.GetSelection().selectionText;
            string file      = Selection_File.GetSelection().selectionText + fileExtension;

            // If the network is new the dictionary of the network is not found in the config
            // so we generate default path
            string path;

            try
            {
                path = Config.Instance[Config.Keys.Subjects][subject][algorithm][Config.AlgorithmKeys.Networks][network][pathKey];
            }
            catch
            {
                path = Config.Instance.GenerateDataFilePath(subject, algorithm, network);
            }

            string absPath = System.IO.Path.GetFullPath(path);

            switch (selectSource)
            {
            case SelectSource.New:
                result = EndSelectionForNew(absPath, file);
                break;

            case SelectSource.Open:
                result = EndSelectionForOpen(absPath, file);
                break;

            case SelectSource.SaveAs:
                result = EndSelectionForSaveAs(absPath, file);
                break;

            case SelectSource.SaveDebug:
                result = EndSelectionForSaveAs(absPath, file);
                break;

            case SelectSource.Debug:
                result = EndSelectionForDebug(absPath, file);
                break;

            case SelectSource.Log:
                result = SelectResult.Log;
                break;

            default:
                result = SelectResult.Quit;
                break;
            }

            switch (result)
            {
            case SelectResult.Quit:
                Close();
                break;

            case SelectResult.Cancel:
                break;

            case SelectResult.Debug:
                Config.Instance.UpdateSelectedDebugFileChanged(subject, algorithm, network, file, path);
                Close();
                break;

            case SelectResult.Log:
                Config.Instance[Config.Keys.SelectedLogFileName] = file;
                Close();
                break;

            default:
                if (selectSource == SelectSource.SaveDebug)
                {
                    Config.Instance.UpdateSelectedDebugFileChanged(subject, algorithm, network, file, path);
                }
                else
                {
                    Config.Instance.UpdateSelectedDataFileChanged(subject, algorithm, network, file, path);
                }
                Close();
                break;
            }
        }